putEventsConfiguration method

Future<PutEventsConfigurationResponse> putEventsConfiguration({
  1. required String accountId,
  2. required String botId,
  3. String? lambdaFunctionArn,
  4. String? outboundEventsHTTPSEndpoint,
})

Creates an events configuration that allows a bot to receive outgoing events sent by Amazon Chime. Choose either an HTTPS endpoint or a Lambda function ARN. For more information, see Bot.

May throw ServiceUnavailableException. May throw ServiceFailureException. May throw ForbiddenException. May throw BadRequestException. May throw UnauthorizedClientException. May throw ResourceLimitExceededException. May throw NotFoundException.

Parameter accountId : The Amazon Chime account ID.

Parameter botId : The bot ID.

Parameter lambdaFunctionArn : Lambda function ARN that allows the bot to receive outgoing events.

Parameter outboundEventsHTTPSEndpoint : HTTPS endpoint that allows the bot to receive outgoing events.

Implementation

Future<PutEventsConfigurationResponse> putEventsConfiguration({
  required String accountId,
  required String botId,
  String? lambdaFunctionArn,
  String? outboundEventsHTTPSEndpoint,
}) async {
  ArgumentError.checkNotNull(accountId, 'accountId');
  ArgumentError.checkNotNull(botId, 'botId');
  final $payload = <String, dynamic>{
    if (lambdaFunctionArn != null) 'LambdaFunctionArn': lambdaFunctionArn,
    if (outboundEventsHTTPSEndpoint != null)
      'OutboundEventsHTTPSEndpoint': outboundEventsHTTPSEndpoint,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/accounts/${Uri.encodeComponent(accountId)}/bots/${Uri.encodeComponent(botId)}/events-configuration',
    exceptionFnMap: _exceptionFns,
  );
  return PutEventsConfigurationResponse.fromJson(response);
}