createParticipant method
Adds a new participant into an on-going chat contact or webRTC call. For more information, see Customize chat flow experiences by integrating custom participants or Enable multi-user web, in-app, and video calling.
May throw ConflictException.
May throw InternalServiceException.
May throw InvalidRequestException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
Parameter contactId :
The identifier of the contact in this instance of Connect Customer.
Supports contacts in the CHAT channel and VOICE (WebRTC) channels. For
WebRTC calls, this should be the initial contact ID that was generated
when the contact was first created (from the StartWebRTCContact API) in
the VOICE channel
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 participantDetails :
Information identifying the participant.
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<CreateParticipantResponse> createParticipant({
required String contactId,
required String instanceId,
required ParticipantDetailsToAdd participantDetails,
String? clientToken,
}) async {
final $payload = <String, dynamic>{
'ContactId': contactId,
'InstanceId': instanceId,
'ParticipantDetails': participantDetails,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/contact/create-participant',
exceptionFnMap: _exceptionFns,
);
return CreateParticipantResponse.fromJson(response);
}