Skip to content

GetWhatsAppMessageMedia

Source: src/AWS/SocialMessaging/GetWhatsAppMessageMedia.ts

Runtime binding for social-messaging:GetWhatsAppMessageMedia.

Retrieves a media file received in a WhatsApp message — either just its metadata (metadataOnly: true) or a full download into an S3 object or presigned URL.

The caller addresses one of the bound account’s phone numbers per request; phone-number ARNs are provisioned by Meta under the WABA, so the deploy-time half grants social-messaging:GetWhatsAppMessageMedia on *. Provide the implementation with Effect.provide(AWS.SocialMessaging.GetWhatsAppMessageMediaHttp).

// init — bind the operation to the linked WABA
const getMedia = yield* AWS.SocialMessaging.GetWhatsAppMessageMedia(account);
// runtime
const { mimeType, fileSize } = yield* getMedia({
mediaId: "media-id-from-inbound-event",
originationPhoneNumberId: "phone-number-id-0123456789abcdef",
destinationS3File: { bucketName: "my-inbox", key: "media/inbound" },
});