One set of endpoints for direct messages on every platform whose API allows them, a message.received webhook for new DMs, and comment-to-DM rules for Instagram and Facebook.
| Platform | List and read | Reply | Media in replies | Mark read | New messages arrive by | Comment automations |
|---|---|---|---|---|---|---|
| Facebook Pages (Messenger) | Yes | Yes, within 24 h | Images, video, files | Yes | Meta webhook, else polling every 5 min | Yes |
| Instagram (professional) | Yes | Yes, within 24 h | Images, video | Yes | Meta webhook, else polling every 5 min | Yes |
| Bluesky | Yes | Yes | No (text only) | Yes | Polling every minute | No |
| X | Yes (last 30 days) | Yes | One image, GIF or video | No | Polling every 15 min | No |
LinkedIn, TikTok, YouTube, Pinterest, Threads and Google Business Profile have no DM API open to apps; inbox calls for their accounts return 400 unsupported_platform. GET /api/v1/platforms shows each platform's inbox capabilities (null when there are none).
Permissions
DM permissions are not part of a normal connection, because users would see them on every consent screen and Meta only grants them after App Review. Ask for them with features: ["inbox"] on the connect link:
curl -X POST https://pogton.com/api/v1/connect-link \
-H "Authorization: Bearer pk_3f9a..." \
-H "Content-Type: application/json" \
-d '{ "user_id": "user_123", "platforms": ["instagram"], "features": ["inbox"] }'
| Platform | Extra permissions with features: ["inbox"] | Notes |
|---|---|---|
pages_messaging, pages_manage_metadata | Advanced access needs Meta App Review. | |
instagram_manage_messages, pages_manage_metadata | Advanced access needs Meta App Review. The Instagram account must be linked to a Facebook Page. | |
| X | dm.read, dm.write | X bills DM reads; see costs. |
| Bluesky | None | The user must create the app password with Allow access to your direct messages turned on. |
The permissions a user granted are stored on the account. If an account lacks them, inbox calls return:
{
"statusCode": 403,
"statusMessage": "The instagram account was connected without instagram_manage_messages. Reconnect it with a connect link that has features: [\"inbox\"] and account_id.",
"data": {
"error": {
"code": "missing_scope",
"message": "…",
"details": {
"platform": "instagram",
"missing_scopes": ["instagram_manage_messages"],
"reconnect": { "account_id": "j97fk2m8q4r1t6v3w8x0y5z2a7b4c9ed", "features": ["inbox"] }
}
}
}
}
Create a connect link with user_id, account_id and features from details.reconnect and send it to the user. For Bluesky, missing_scope means the app password has no DM access; the user reconnects with a new app password.
If you use your own Meta app, it is your app that needs App Review for these permissions. Until then, only people with a role on the app (admins, developers, testers) can grant them.
List conversations
curl https://pogton.com/api/v1/accounts/j97fk2m8q4r1t6v3w8x0y5z2a7b4c9ed/conversations \
-H "Authorization: Bearer pk_3f9a..."
{
"account_id": "j97fk2m8q4r1t6v3w8x0y5z2a7b4c9ed",
"platform": "instagram",
"data": [
{
"id": "aWdfZAG06MTpJR01lc3NhZA2VUaHJlYWQ6...",
"participants": [{ "id": "6543210987654321", "name": null, "username": "maria.design", "avatar_url": null }],
"updated_at": "2026-11-05T14:02:11+0000",
"unread_count": 1,
"last_message": {
"id": "aWdfZAG1faXRlbToxOklHTWVzc2FnZA...",
"conversation_id": "aWdfZAG06MTpJR01lc3NhZA2VUaHJlYWQ6...",
"text": "Do you ship to Norway?",
"sender_id": "6543210987654321",
"sender_name": "maria.design",
"from_me": false,
"created_at": "2026-11-05T14:02:11+0000",
"attachments": []
}
}
],
"next_cursor": "QVFIUm..."
}
Pass next_cursor as cursor for the next page. participants leaves out the connected account itself.
Read a conversation
curl "https://pogton.com/api/v1/accounts/j97fk2m8q4r1t6v3w8x0y5z2a7b4c9ed/conversations/CONVERSATION_ID/messages" \
-H "Authorization: Bearer pk_3f9a..."
Messages come newest first, in the same shape as last_message above. from_me is true for messages the account sent. URL-encode the conversation ID; Instagram IDs can contain = and /.
Reply
curl -X POST "https://pogton.com/api/v1/accounts/j97fk2m8q4r1t6v3w8x0y5z2a7b4c9ed/conversations/CONVERSATION_ID/messages" \
-H "Authorization: Bearer pk_3f9a..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 6f1c2b7e-reply-1" \
-d '{ "text": "Yes, we ship to Norway in 3–5 days.", "media": ["https://cdn.example.com/shipping.jpg"] }'
The response (201) is the sent message. Rules per platform:
- Facebook and Instagram only allow replies within 24 hours of the person's last message. After that the API returns
422 invalid_request. With"tag": "HUMAN_AGENT"you can reply for up to 7 days if Meta approved the Human Agent permission for your app. Each media item is sent as its own message, text last. - X takes one image, GIF or video per message. The recipient must accept DMs from the account.
- Bluesky is text only (up to 1,000 characters).
To message someone by their ID, for example the sender_id of a message.received event (Meta webhooks don't say which conversation a message belongs to), use:
curl -X POST https://pogton.com/api/v1/accounts/j97fk2m8q4r1t6v3w8x0y5z2a7b4c9ed/messages \
-H "Authorization: Bearer pk_3f9a..." \
-H "Content-Type: application/json" \
-d '{ "recipient_id": "6543210987654321", "text": "Thanks for your message!" }'
On Bluesky (recipient_id is a DID) and X (a numeric user ID) this starts a conversation if there is none, as long as the person accepts DMs from the account. Facebook and Instagram only reach people who wrote to the account in the last 24 hours.
Mark as read
curl -X POST "https://pogton.com/api/v1/accounts/j97fk2m8q4r1t6v3w8x0y5z2a7b4c9ed/conversations/CONVERSATION_ID/read" \
-H "Authorization: Bearer pk_3f9a..."
Works on Facebook, Instagram and Bluesky. X has no API for it and returns 400 not_supported.
New messages
Subscribe a webhook endpoint to message.received:
{
"id": "evt_5b0c1f8a9e2d4c6b7a8f9e0d",
"event": "message.received",
"created_at": "2026-11-05T14:02:13.000Z",
"test": false,
"data": {
"account_id": "j97fk2m8q4r1t6v3w8x0y5z2a7b4c9ed",
"platform": "instagram",
"user_id": "user_123",
"source": "webhook",
"message": {
"id": "aWdfZAG1faXRlbToxOklHTWVzc2FnZA...",
"conversation_id": null,
"text": "Do you ship to Norway?",
"sender_id": "6543210987654321",
"sender_name": null,
"from_me": false,
"created_at": "2026-11-05T14:02:11.000Z",
"attachments": []
}
}
}
Each message is sent once (deduplicated by message ID). How Pogton learns about it depends on the platform:
- Facebook and Instagram: Meta pushes new messages to Pogton (
source: "webhook"). For accounts whose events don't arrive that way, Pogton checks every 5 minutes (source: "polling"). - Bluesky: checked every minute.
- X: checked every 15 minutes.
Polling only runs for organizations with an endpoint subscribed to message.received (or *), and only for accounts that have the inbox permissions. Pogton does not store message text; it keeps message IDs for 14 days to avoid duplicates.
Costs on X
X charges for DM reads under its pay-per-use pricing (or requires a paid tier). Every conversation list, message page and poll is a read on the X app the account was connected with: Pogton's, or your own. Polling one X account costs about 96 reads a day. Unsubscribe from message.received to stop polling.
Comment automations
A comment automation sends a DM to anyone who comments a keyword on an Instagram or Facebook post, and can also reply to the comment publicly. The DM is a Meta private reply, which works even if the person never messaged the account, once per comment and within 7 days of it.
curl -X POST https://pogton.com/api/v1/comment-automations \
-H "Authorization: Bearer pk_3f9a..." \
-H "Content-Type: application/json" \
-d '{
"account_id": "j97fk2m8q4r1t6v3w8x0y5z2a7b4c9ed",
"name": "Spring guide",
"keywords": ["guide", "link"],
"post_ids": ["17895695668004550"],
"dm_text": "Hi {name}! Here is the guide: https://example.com/guide",
"reply_text": "Sent you a DM 📩"
}'
| Field | Type | Required | Description |
|---|---|---|---|
account_id | string | Yes | An Instagram or Facebook account with the inbox permissions. |
keywords | string | No | A comment matches when it contains any of them, ignoring case. Empty or left out: every comment matches. |
match | string | No | contains (default), word (whole word) or exact (the whole comment). |
post_ids | string | No | Platform post IDs (targets[].platform_post_id). Left out: every post. |
dm_text | string | Yes | The DM, up to 1,000 characters. {name} becomes the commenter's first name, {username} their username. |
reply_text | string | No | A public reply to the comment, with the same placeholders. |
name | string | No | Your label. |
enabled | boolean | No | Default true. |
How it behaves:
- One DM per person per rule and post. A second comment by the same person on the same post doesn't trigger the rule again.
- Only comments made after the rule was created count. The account's own comments never trigger it.
- With Meta webhooks set up, comments are handled within seconds. Otherwise Pogton checks the watched posts every 5 minutes; for rules without
post_idsthat means the account's posts published through Pogton in the last 7 days. - Every time a rule fires, Pogton sends
automation.triggeredto endpoints subscribed to it, withdm_sent, the comment, anderrorif the DM or the public reply failed.trigger_counton the rule counts the DMs sent.
Manage rules with GET /comment-automations (optionally ?account_id=), GET, PATCH and DELETE /comment-automations/{id}. PATCH with "enabled": false pauses a rule; null clears name, post_ids or reply_text.
Sandbox
With a test key, inbox calls on a sandbox account of a supported platform return a fixed conversation and simulate sending, and comment automations can be created and edited (they never fire).
MCP
The MCP server has the same calls as tools: list_conversations, list_messages, send_message, send_direct_message, mark_conversation_read, list_comment_automations, get_comment_automation, create_comment_automation, update_comment_automation and delete_comment_automation.
Setting up Meta webhooks (self-hosted apps)
For accounts connected through Pogton's Meta app, Pogton receives these webhooks. If you connect accounts through your own Meta app, set up its webhooks so DMs and comments arrive in real time instead of by polling:
- In the Meta app dashboard, add the Webhooks product.
- For the Page object, set the callback URL to
https://pogton.com/api/webhooks/meta?org=YOUR_ORG_SLUG, use the verify token Pogton support gives you, and subscribe tomessagesandfeed. - For the Instagram object, use the same callback URL and subscribe to
messagesandcomments.
Pogton subscribes each connected Page to the app's webhooks (subscribed_apps) the first time it polls the account or a comment automation is created, which needs pages_manage_metadata.
