getWhatsAppMessageMedia method
Get a media file from the WhatsApp service. On successful completion the
media file is retrieved from Meta and stored in the specified Amazon S3
bucket. Use either destinationS3File or
destinationS3PresignedUrl for the destination. If both are
used then an InvalidParameterException is returned.
May throw AccessDeniedByMetaException.
May throw DependencyException.
May throw InternalServiceException.
May throw InvalidParametersException.
May throw ResourceNotFoundException.
May throw ThrottledRequestException.
Parameter mediaId :
The unique identifier for the media file.
Parameter originationPhoneNumberId :
The unique identifier of the originating phone number for the WhatsApp
message media. The phone number identifiers are formatted as
phone-number-id-01234567890123456789012345678901. Use GetLinkedWhatsAppBusinessAccount
to find a phone number's id.
Parameter destinationS3File :
The bucketName and key of the S3 media file.
Parameter destinationS3PresignedUrl :
The presign url of the media file.
Parameter metadataOnly :
Set to True to get only the metadata for the file.
Implementation
Future<GetWhatsAppMessageMediaOutput> getWhatsAppMessageMedia({
required String mediaId,
required String originationPhoneNumberId,
S3File? destinationS3File,
S3PresignedUrl? destinationS3PresignedUrl,
bool? metadataOnly,
}) async {
final $payload = <String, dynamic>{
'mediaId': mediaId,
'originationPhoneNumberId': originationPhoneNumberId,
if (destinationS3File != null) 'destinationS3File': destinationS3File,
if (destinationS3PresignedUrl != null)
'destinationS3PresignedUrl': destinationS3PresignedUrl,
if (metadataOnly != null) 'metadataOnly': metadataOnly,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/v1/whatsapp/media/get',
exceptionFnMap: _exceptionFns,
);
return GetWhatsAppMessageMediaOutput.fromJson(response);
}