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
| Name | Required | Description | Default |
|---|---|---|---|
| recipient_id | Yes | Instagram Scoped User ID (IGSID) of recipient | |
| message | Yes | Message text (max 1000 characters) |
Implementation Reference
- src/client.ts:454-465 (handler)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"], - src/index.ts:417-420 (handler)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); }