Skip to main content
modiva.ai
Sign In
← All API tutorials

API Tutorial

How to read & reply to X comments via API

To reply to X comments via API, connect X through Modiva, list comments with `comments_list`, then post a response with `comments_reply` — useful for support, moderation and AI auto-replies.

Managing X engagement at scale means pulling comments and replying without a human in every loop. Modiva exposes `comments_list` and `comments_reply` so you can build moderation, support or AI-assisted reply workflows on X with the same two calls you'd use anywhere.

Step by step

1

Create a Modiva account and MCP key

Sign up free and generate an MCP key (`mk_live_…`) from the dashboard. The same key authenticates both the hosted MCP server (for AI agents) and the REST API (for your backend), so you only manage one credential.

2

Connect your X account

From the dashboard, click Connect and choose X. Modiva runs the OAuth flow and requests the right scopes for you, then stores the access + refresh tokens in an encrypted vault and keeps them fresh — you never handle X's raw API credentials. The connection gets a stable `connectionId` you reference in every call.

3

List comments with comments_list

Call `comments_list` with the connection ID and a post ID to pull recent X comments, including author, text and timestamps — paginated and normalised to the same shape across every platform.

4

Respond with comments_reply

Call `comments_reply` with the target `comment_id` and your text. Over MCP, an AI agent can read the thread, draft a contextual reply and post it back to X automatically — great for first-line support and community management.

Example request

Call the comments_reply tool through Modiva’s REST API. The same tool is available to AI agents over the MCP server at https://mcp.modiva.ai/v1.

POST /v1/tools/invoke
curl -X POST https://api.modiva.ai/v1/tools/invoke \
  -H "Authorization: Bearer mk_live_…" \
  -H "Content-Type: application/json" \
  -d '{
    "tool": "comments_reply",
    "connectionId": "conn_…",
    "args": { "comment_id": "c_123", "text": "Thanks for the kind words! 🙏" }
  }'

Try it with X

Start free

FAQ

Can I auto-reply to X comments with AI?

Yes. Expose `comments_list` + `comments_reply` to an MCP client and the agent can read each X comment and post a tailored response on its own.

Are comments returned in the same format across platforms?

Yes — Modiva normalises X comments to a unified shape, so the same code handles comments on every connected platform.


Keep building with X

X API integrationX MCP serverHow to post to X via APIHow to schedule X posts via APIHow to send X messages via APIHow to pull X analytics via APIHow to read & reply to Instagram comments via API