Skip to main content
Glama

ig_get_conversations

Retrieve Instagram direct message conversations from the inbox or spam folder using the Instagram Messaging API. Supports pagination and conversation limits for organized message management.

Instructions

Get Instagram DM conversations list. Requires 'instagram_manage_messages' permission and the Instagram Messaging API.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
folderNoFolder to retrieve (default: inbox)
limitNoNumber of conversations
afterNoPagination cursor

Implementation Reference

  • The implementation of the 'ig_get_conversations' MCP tool. It validates inputs via zod, constructs the API parameters, and calls the MetaClient's ig method to fetch conversation data.
    server.tool(
      "ig_get_conversations",
      "Get Instagram DM conversations list. Requires 'instagram_manage_messages' permission and the Instagram Messaging API.",
      {
        folder: z.enum(["inbox", "spam"]).optional().describe("Folder to retrieve (default: inbox)"),
        limit: z.number().optional().describe("Number of conversations"),
        after: z.string().optional().describe("Pagination cursor"),
      },
      async ({ folder, limit, after }) => {
        try {
          const params: Record<string, unknown> = {
            platform: "instagram",
            fields: "id,updated_time,participants,messages{id,message,from,created_time}",
          };
          if (folder) params.folder = folder;
          if (limit) params.limit = limit;
          if (after) params.after = after;
          const { data, rateLimit } = await client.ig("GET", `/${client.igUserId}/conversations`, params);
          return { content: [{ type: "text", text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
        } catch (error) {
          return { content: [{ type: "text", text: `Get conversations 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