sendOutboundWebNotification method
Sends an outbound web notification to a customer's web browser for outbound campaigns. For more information about outbound campaigns, see Set up Connect Customer outbound campaigns.
May throw AccessDeniedException.
May throw InternalServiceException.
May throw InvalidRequestException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
Parameter browserId :
A unique identifier for the customer's web browser instance to which the
notification is being sent.
Parameter content :
The content of the web notification, including the notification type, the
view to render, and any optional attributes used to populate it.
Parameter destination :
The destination for the web notification, specifying the communication
widget that delivers the notification and the customer profile of the
recipient.
Parameter expiresAt :
The timestamp, in Unix epoch time format, at which the web notification
expires. After this time, the notification is no longer delivered to the
customer's browser.
Parameter instanceId :
The identifier of the Connect Customer instance. You can find
the instance ID in the Amazon Resource Name (ARN) of the instance.
Parameter sessionId :
A unique identifier for the customer's web session to which the
notification is being sent.
Parameter source :
The source of the web notification. A SourceCampaign object
identifies the campaign and outbound request that triggered this
notification.
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<void> sendOutboundWebNotification({
required String browserId,
required WebNotificationContent content,
required WidgetDestination destination,
required DateTime expiresAt,
required String instanceId,
required String sessionId,
required WebNotificationSource source,
String? clientToken,
}) async {
final $payload = <String, dynamic>{
'BrowserId': browserId,
'Content': content,
'Destination': destination,
'ExpiresAt': unixTimestampToJson(expiresAt),
'SessionId': sessionId,
'Source': source,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/instance/${Uri.encodeComponent(instanceId)}/outbound-web-notification',
exceptionFnMap: _exceptionFns,
);
}