createPushNotificationRegistration method
Creates registration for a device token and a chat contact to receive real-time push notifications. For more information about push notifications, see Set up push notifications in Connect Customer for mobile chat in the Connect Customer Administrator Guide.
May throw AccessDeniedException.
May throw InternalServiceException.
May throw InvalidParameterException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
Parameter contactConfiguration :
The contact configuration for push notification registration.
Parameter deviceToken :
The push notification token issued by the Apple or Google gateways.
Parameter deviceType :
The device type to use when sending the message.
Parameter instanceId :
The identifier of the Amazon Connect instance. You can find
the instance ID in the Amazon Resource Name (ARN) of the instance.
Parameter pinpointAppArn :
The Amazon Resource Name (ARN) of the Pinpoint application.
Parameter clientToken :
A unique, case-sensitive identifier that you provide to ensure the
idempotency of the request. If not provided, the Amazon Web Services SDK
populates this field. For more information about idempotency, see Making
retries safe with idempotent APIs.
Implementation
Future<CreatePushNotificationRegistrationResponse>
createPushNotificationRegistration({
required ContactConfiguration contactConfiguration,
required String deviceToken,
required DeviceType deviceType,
required String instanceId,
required String pinpointAppArn,
String? clientToken,
}) async {
final $payload = <String, dynamic>{
'ContactConfiguration': contactConfiguration,
'DeviceToken': deviceToken,
'DeviceType': deviceType.value,
'PinpointAppArn': pinpointAppArn,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri:
'/push-notification/${Uri.encodeComponent(instanceId)}/registrations',
exceptionFnMap: _exceptionFns,
);
return CreatePushNotificationRegistrationResponse.fromJson(response);
}