postWhatsAppMessageMedia method

Future<PostWhatsAppMessageMediaOutput> postWhatsAppMessageMedia({
  1. required String originationPhoneNumberId,
  2. S3File? sourceS3File,
  3. S3PresignedUrl? sourceS3PresignedUrl,
})

Upload a media file to the WhatsApp service. Only the specified originationPhoneNumberId has the permissions to send the media file when using SendWhatsAppMessage. You must use either sourceS3File or sourceS3PresignedUrl for the source. If both or neither are specified then an InvalidParameterException is returned.

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

Parameter originationPhoneNumberId : The ID of the phone number to associate with the WhatsApp media file. The phone number identifiers are formatted as phone-number-id-01234567890123456789012345678901. Use GetLinkedWhatsAppBusinessAccount to find a phone number's id.

Parameter sourceS3File : The source S3 url for the media file.

Parameter sourceS3PresignedUrl : The source presign url of the media file.

Implementation

Future<PostWhatsAppMessageMediaOutput> postWhatsAppMessageMedia({
  required String originationPhoneNumberId,
  S3File? sourceS3File,
  S3PresignedUrl? sourceS3PresignedUrl,
}) async {
  final $payload = <String, dynamic>{
    'originationPhoneNumberId': originationPhoneNumberId,
    if (sourceS3File != null) 'sourceS3File': sourceS3File,
    if (sourceS3PresignedUrl != null)
      'sourceS3PresignedUrl': sourceS3PresignedUrl,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/v1/whatsapp/media',
    exceptionFnMap: _exceptionFns,
  );
  return PostWhatsAppMessageMediaOutput.fromJson(response);
}