Instagram: accounts, comments and DMs
List Instagram accounts, reply to and hide comments and send DMs through the XBASE API, with request and response examples.
Updated on
With the Instagram scopes, the API lists the accounts connected to the workspace, replies to and hides comments and sends DMs, through the same accounts you use in XBASE.
List the accounts
GET https://api.xbase.app/api/external/v1/instagram/accountsScope instagram:read. 200 response:
[
{
"connectionId": "6d1f…",
"instagramAccountId": "17841400000000000",
"username": "mycompany",
"name": "My Company",
"profilePictureUrl": "https://…",
"messagingAccess": true,
"missingScopes": []
}
]| Field | Description |
|---|---|
connectionId | Account id in XBASE. Goes in connectionId in the other routes |
instagramAccountId | Account id on Instagram |
username · name · profilePictureUrl | Profile data |
messagingAccess | Whether the account can send DMs through the API |
missingScopes | Permissions missing from the account's connection to Meta |
Only active accounts are listed.
Reply to a comment
POST https://api.xbase.app/api/external/v1/instagram/comments/{commentId}/replyScope instagram:act. Body: { "connectionId": "…", "message": "Thank you!" }, with message up to 2,200 characters. The reply is public, under the comment. Response: { "id": "…" }, the reply's id on Instagram.
Reply by DM (private reply)
POST https://api.xbase.app/api/external/v1/instagram/comments/{commentId}/private-replyScope instagram:act. Same body as the previous item. Sends a DM to the comment's author. Response: { "messageId": "…" }.
Meta accepts one private reply per comment, within 7 days. The second one returns 422 META_ERROR.
Hide a comment
POST https://api.xbase.app/api/external/v1/instagram/comments/{commentId}/hideScope instagram:act. Body: { "connectionId": "…", "hidden": true } (false shows it again). Response: { "success": true }.
Send a DM
POST https://api.xbase.app/api/external/v1/instagram/messagesScope instagram:act. Body: { "connectionId": "…", "recipientId": "…", "text": "Hi!" }, with text up to 1,000 characters. recipientId is the person's id on Instagram, which comes in the webhook events. Response: { "messageId": "…" }.
Meta only accepts a DM within the 24-hour window since the person's last message. Outside it, the response is 422 META_ERROR.
Instagram errors
| Status | code | When |
|---|---|---|
| 400 | (no code) | Invalid field or commentId in the wrong format |
| 404 | NOT_FOUND | connectionId is not an account of this workspace |
| 422 | META_ERROR | Meta rejected it: sending limit, missing permission, outside the 24-hour window or comment already replied to. The message has the reason |