Skip to main content
Glama
EvandroSchechtel

WhatsApp Business MCP Server

upload_media

Upload media files to WhatsApp Business for later use in messages. Store images, documents, or other files with a public URL to reference when sending communications.

Instructions

Upload a media file for later sending. Returns a media_id that can be used with send_media_message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_urlYesPublic URL of the file to upload
typeYesMIME type (e.g., image/jpeg, application/pdf)

Implementation Reference

  • The core logic that performs the API request to upload media to WhatsApp.
    async uploadMedia(file: string, type: string) {
      // Note: actual file upload requires multipart/form-data
      // This is a simplified version. In production, use FormData.
      return this.request(`/${this.config.phoneNumberId}/media`, "POST", {
        messaging_product: "whatsapp",
        type,
        link: file,
      });
    }
  • src/index.ts:391-402 (registration)
    Registration of the "upload_media" MCP tool.
    server.tool(
      "upload_media",
      "Upload a media file for later sending. Returns a media_id that can be used with send_media_message.",
      {
        file_url: z.string().describe("Public URL of the file to upload"),
        type: z.string().describe("MIME type (e.g., image/jpeg, application/pdf)"),
      },
      async ({ file_url, type }) =>
        executeWithHooks("upload_media", { file_url, type }, config, () =>
          wa.uploadMedia(file_url, type)
        )
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/EvandroSchechtel/mcp-whatsapp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server