sendEvent method
Sends an event. Note that ConnectionToken is used for invoking this API instead of ParticipantToken.
The Amazon Connect Participant Service APIs do not use Signature Version 4 authentication.
May throw AccessDeniedException. May throw InternalServerException. May throw ThrottlingException. May throw ValidationException.
Parameter connectionToken
:
The authentication token associated with the participant's connection.
Parameter contentType
:
The content type of the request. Supported types are:
- application/vnd.amazonaws.connect.event.typing
- application/vnd.amazonaws.connect.event.connection.acknowledged
Parameter clientToken
:
A unique, case-sensitive identifier that you provide to ensure the
idempotency of the request.
Parameter content
:
The content of the event to be sent (for example, message text). This is
not yet supported.
Implementation
Future<SendEventResponse> sendEvent({
required String connectionToken,
required String contentType,
String? clientToken,
String? content,
}) async {
ArgumentError.checkNotNull(connectionToken, 'connectionToken');
_s.validateStringLength(
'connectionToken',
connectionToken,
1,
1000,
isRequired: true,
);
ArgumentError.checkNotNull(contentType, 'contentType');
_s.validateStringLength(
'contentType',
contentType,
1,
100,
isRequired: true,
);
_s.validateStringLength(
'clientToken',
clientToken,
0,
500,
);
_s.validateStringLength(
'content',
content,
1,
1024,
);
final headers = <String, String>{
'X-Amz-Bearer': connectionToken.toString(),
};
final $payload = <String, dynamic>{
'ContentType': contentType,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
if (content != null) 'Content': content,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/participant/event',
headers: headers,
exceptionFnMap: _exceptionFns,
);
return SendEventResponse.fromJson(response);
}