Instagram comment-to-DM automation — via API

Automate Instagram comment-to-DM via API

CommentKeyword turns Instagram comments into automated DM conversations. The REST API lets you create keyword triggers, set reply copy, and connect AI agents programmatically — so your tools, workflows, and AI agents can manage it all without touching the dashboard.

PAT authCreate keywordsSet replies + DMsAttach AI agentsn8n / Make / ZapierMCP on roadmap
Full campaign setup in one script
// 1. Find your live AI agent
const agentsResponse = await ck.get("/api/agents");
const agent = agentsResponse.data.find((item) => item.status === "live");
if (!agent) throw new Error("No live agent found");

// 2. Create the keyword trigger
const keywordResponse = await ck.post("/api/keywords", {
  keyword: "GUIDE",
  matchMode: "contains",
  scope: "global",
  commentReplies: ["Sent you the details!"],
  dmMessages: ["Here's your free guide."],
  delaySec: 20,
  aiAgentId: agent.id
});

// 3. Go live.
console.log("Live:", keywordResponse.data.id);

Everything you can control via API

One PAT token gives your code full control over keyword triggers, reply copy, and AI agent connections.

Create and manage keywords

POST a new keyword trigger in one request. Set the match mode (exact or contains), scope (global or post-specific), and message variants without touching the dashboard.

POST /api/keywords
{
  "keyword": "GUIDE",
  "matchMode": "contains",
  "scope": "global"
}

Set comment replies and DMs

Include commentReplies and dmMessages in the same create or update call. Change copy, test variants, or rotate messages across campaigns - all from your own code.

{
  "commentReplies": ["Sent you the details!"],
  "dmMessages": ["Here's the guide you asked for."],
  "delaySec": 20
}

Attach an AI agent by ID

If you have a Live AI agent in the workspace, link it to any keyword by passing its public ID. The agent takes over DM conversations automatically after the hook question fires.

PATCH /api/keywords/{id}
{
  "aiAgentId": "a6be1900-8f4f-4ae6-8f4e-48f8b28f0f17"
}
Built for AI-first workflows

Let your AI agent set itself up

If you are building an AI system - a custom GPT, an n8n agent, a Claude workflow, or your own backend - you can give it a CommentKeyword API token and let it manage the full Instagram automation setup.

The agent can read your existing Live agents, create the keyword trigger with the right reply copy, attach the correct AI agent, and activate everything - without any manual dashboard interaction.

  • No dashboard login required once the token is configured
  • AI agent IDs are readable via GET /api/agents
  • Keywords can be created in a single POST request
  • Partial PATCH updates let you swap copy or agents without recreating
  • Deactivate keywords when a campaign ends through PATCH

Example: agent-driven campaign launch

1. Campaign trigger fires

A new product post goes live. Your n8n workflow or AI agent receives the event.

2. Agent fetches available AI agents

Calls GET /api/agents to find the right Live agent for this campaign type.

3. Agent creates the keyword

Posts the keyword, comment reply, DM copy, and aiAgentId in one call. Sets delaySec to 20.

4. Live in seconds

CommentKeyword starts monitoring comments for that keyword immediately. No human in the loop.

Who uses the API

Any workflow that needs to create or update Instagram keyword automation without manual dashboard work.

AI agents that configure themselves

Give your AI system a PAT and it can create the keyword, write the reply, and wire itself in as the conversation agent - without any manual dashboard work.

n8n, Make, and Zapier flows

Trigger keyword creation or updates from automation platforms when a campaign starts, a product launches, or a lead magnet goes live.

Custom dashboards and agency tools

Build your own management interface on top of the API. Create and update keywords for multiple clients without logging into each workspace separately.

Campaign scripting

Script an entire Instagram campaign setup: create the keyword, set the DM copy, and update or deactivate it on a schedule - all from a single script.

On the roadmap

MCP server - coming next

A Model Context Protocol server would expose CommentKeyword actions as native tools for Claude, GPT, and any MCP-compatible AI system. Instead of writing HTTP calls, your agent would call tools like create_keyword or attach_agent directly.

If you are building an AI workflow that would benefit from an MCP integration, reach out - it helps us prioritize.

Get started in minutes

Sign up, generate a PAT token from your workspace settings, and start making requests.

1. Generate a PAT token

From your workspace settings, create a Personal Access Token and choose the permissions your integration needs: keywords:read, keywords:write, or agents:read.

2. Make your first request

curl -H "Authorization: Bearer TOKEN" \
  https://commentkeyword.com/api/keywords

3. Build your workflow

Create keywords, attach agents, set reply copy, and manage campaigns from your code, automation platform, or AI system. The full reference is available at /api-docs.

Frequently asked questions

What can I do with the CommentKeyword API?

You can list, create, read, update, and delete keyword triggers. Each keyword can include comment replies, DM messages, match settings, and an optional AI agent attachment. The API also exposes a read endpoint for your AI agents so you can look up agent IDs programmatically.

How do I authenticate?

Use a Personal Access Token (PAT) issued from your workspace settings. Pass it in the Authorization header as a Bearer token. Tokens are workspace-scoped and do not expire automatically.

Can I attach an AI agent to a keyword via the API?

Yes. Include the aiAgentId field in a POST or PATCH request. The value must be the public ID of a Live agent in the same workspace. You can retrieve all agent IDs from the GET /api/agents endpoint.

Is an MCP server available?

Not yet, but it is on the roadmap. An MCP server would let AI agents interact with CommentKeyword directly through the Model Context Protocol, without writing raw HTTP calls. If you are building an AI system and this matters to your workflow, reach out - it helps prioritize.

Do I need a paid plan to use the API?

The API is available on all plans including the free tier. Free accounts include 300 automated DMs per month. Paid plans unlock higher volumes, AI agents, and additional features that are also manageable via the API.

Is there a rate limit?

Standard rate limits apply per workspace token. For high-volume automation use cases, contact support to discuss limits that match your workflow.

Build once. Let the API handle the rest.

CommentKeyword gives your code - and your AI agents - full control over keyword triggers, reply copy, and AI conversation routing. Start free and add the API token from your workspace settings.