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
| Name | Required | Description | Default |
|---|---|---|---|
| recipient_id | Yes | Instagram-scoped user ID of the recipient | |
| message | Yes | Message text to send |
Implementation Reference
- src/tools/instagram/messaging.ts:57-76 (handler)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 }; } } );