Skip to main content
Glama

send_dm

Send direct messages on Instagram using the Graph API. Reply to conversations within 24 hours with text messages up to 1000 characters.

Instructions

Send Instagram direct message. Requires instagram_manage_messages with Advanced Access. Can only reply within 24 hours.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
recipient_idYesInstagram Scoped User ID (IGSID) of recipient
messageYesMessage text (max 1000 characters)

Implementation Reference

  • The actual implementation of sending a DM via the API.
    async sendDM(
      recipientId: string,
      message: string
    ): Promise<{ messageId: string }> {
      const data = await this.request("POST", "me/messages", {
        body: {
          recipient: { id: recipientId },
          message: { text: message },
        },
        useFacebookApi: true,
      });
      return { messageId: data.message_id ?? "" };
  • src/index.ts:202-212 (registration)
    Registration of the send_dm tool in the MCP server.
    {
      name: "send_dm",
      description:
        "Send Instagram direct message. Requires instagram_manage_messages with Advanced Access. Can only reply within 24 hours.",
      inputSchema: {
        type: "object" as const,
        properties: {
          recipient_id: { type: "string", description: "Instagram Scoped User ID (IGSID) of recipient" },
          message: { type: "string", description: "Message text (max 1000 characters)", maxLength: 1000 },
        },
        required: ["recipient_id", "message"],
  • Dispatch logic in the tool handler that calls the client method.
    case "send_dm": {
      const result = await c.sendDM(args.recipient_id, args.message);
      return JSON.stringify(result, null, 2);
    }

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/mcpware/instagram-mcp'

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