get_media_url
Retrieve temporary download URLs for media files from WhatsApp Business messages to access and process customer-sent images, videos, or documents.
Instructions
Get the download URL for a received media file. URLs are valid for 5 minutes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| media_id | Yes | Media ID from a received message webhook |
Implementation Reference
- src/whatsapp-client.ts:284-286 (handler)The implementation of the getMediaUrl method that fetches the media URL using a request.
async getMediaUrl(mediaId: string) { return this.request(`/${mediaId}`); } - src/index.ts:404-414 (registration)The registration of the 'get_media_url' tool, which handles the user input and calls the wa.getMediaUrl method.
server.tool( "get_media_url", "Get the download URL for a received media file. URLs are valid for 5 minutes.", { media_id: z.string().describe("Media ID from a received message webhook"), }, async ({ media_id }) => executeWithHooks("get_media_url", { media_id }, config, () => wa.getMediaUrl(media_id) ) );