createContactChannel method
A contact channel is the method that Incident Manager uses to engage your contact.
May throw AccessDeniedException.
May throw ConflictException.
May throw DataEncryptionException.
May throw InternalServerException.
May throw ThrottlingException.
May throw ValidationException.
Parameter contactId :
The Amazon Resource Name (ARN) of the contact you are adding the contact
channel to.
Parameter deliveryAddress :
The details that Incident Manager uses when trying to engage the contact
channel. The format is dependent on the type of the contact channel. The
following are the expected formats:
- SMS - '+' followed by the country code and phone number
- VOICE - '+' followed by the country code and phone number
- EMAIL - any standard email format
Parameter name :
The name of the contact channel.
Parameter type :
Incident Manager supports three types of contact channels:
-
SMS -
VOICE -
EMAIL
Parameter deferActivation :
If you want to activate the channel at a later time, you can choose to
defer activation. Incident Manager can't engage your contact channel until
it has been activated.
Parameter idempotencyToken :
A token ensuring that the operation is called only once with the specified
details.
Implementation
Future<CreateContactChannelResult> createContactChannel({
required String contactId,
required ContactChannelAddress deliveryAddress,
required String name,
required ChannelType type,
bool? deferActivation,
String? idempotencyToken,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'SSMContacts.CreateContactChannel'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ContactId': contactId,
'DeliveryAddress': deliveryAddress,
'Name': name,
'Type': type.value,
if (deferActivation != null) 'DeferActivation': deferActivation,
'IdempotencyToken': idempotencyToken ?? _s.generateIdempotencyToken(),
},
);
return CreateContactChannelResult.fromJson(jsonResponse.body);
}