sendWhatsAppMessage method

Future<SendWhatsAppMessageOutput> sendWhatsAppMessage({
  1. required Uint8List message,
  2. required String metaApiVersion,
  3. required String originationPhoneNumberId,
})

Send a WhatsApp message. For examples of sending a message using the Amazon Web Services CLI, see Sending messages in the Amazon Web Services End User Messaging Social User Guide .

May throw DependencyException. May throw InternalServiceException. May throw InvalidParametersException. May throw ResourceNotFoundException. May throw ThrottledRequestException.

Parameter message : The message to send through WhatsApp. The length is in KB. The message field passes through a WhatsApp Message object, see Messages in the WhatsApp Business Platform Cloud API Reference.

Parameter metaApiVersion : The API version for the request formatted as v{VersionNumber}. For a list of supported API versions and Amazon Web Services Regions, see Amazon Web Services End User Messaging Social API Service Endpoints in the Amazon Web Services General Reference.

Parameter originationPhoneNumberId : The ID of the phone number used to send the WhatsApp message. If you are sending a media file only the originationPhoneNumberId used to upload the file can be used. Phone number identifiers are formatted as phone-number-id-01234567890123456789012345678901. Use GetLinkedWhatsAppBusinessAccount to find a phone number's id.

Implementation

Future<SendWhatsAppMessageOutput> sendWhatsAppMessage({
  required Uint8List message,
  required String metaApiVersion,
  required String originationPhoneNumberId,
}) async {
  final $payload = <String, dynamic>{
    'message': base64Encode(message),
    'metaApiVersion': metaApiVersion,
    'originationPhoneNumberId': originationPhoneNumberId,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/v1/whatsapp/send',
    exceptionFnMap: _exceptionFns,
  );
  return SendWhatsAppMessageOutput.fromJson(response);
}