Skip to main content
Glama

ig_send_message

Send direct messages on Instagram to users who have previously messaged you, using the Meta MCP server for automated communication.

Instructions

Send a DM to a user. Requires 'instagram_manage_messages' permission. Can only message users who have messaged you first (24hr window for standard, 7-day for human agent).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
recipient_idYesInstagram-scoped user ID of the recipient
messageYesMessage text to send

Implementation Reference

  • The `ig_send_message` tool is registered and implemented within `src/tools/instagram/messaging.ts`. It takes `recipient_id` and `message` as inputs and sends a POST request via the MetaClient to the Instagram Messaging API.
    server.tool(
      "ig_send_message",
      "Send a DM to a user. Requires 'instagram_manage_messages' permission. Can only message users who have messaged you first (24hr window for standard, 7-day for human agent).",
      {
        recipient_id: z.string().describe("Instagram-scoped user ID of the recipient"),
        message: z.string().describe("Message text to send"),
      },
      async ({ recipient_id, message }) => {
        try {
          const { data, rateLimit } = await client.ig("POST", `/${client.igUserId}/messages`, {
            recipient: JSON.stringify({ id: recipient_id }),
            message: JSON.stringify({ text: message }),
            messaging_type: "RESPONSE",
          });
          return { content: [{ type: "text", text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
        } catch (error) {
          return { content: [{ type: "text", text: `Send message failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
        }
      }
    );

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/mikusnuz/meta-mcp'

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