Instagram

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/accounts

Scope instagram:read. 200 response:

[
  {
    "connectionId": "6d1f…",
    "instagramAccountId": "17841400000000000",
    "username": "mycompany",
    "name": "My Company",
    "profilePictureUrl": "https://…",
    "messagingAccess": true,
    "missingScopes": []
  }
]
FieldDescription
connectionIdAccount id in XBASE. Goes in connectionId in the other routes
instagramAccountIdAccount id on Instagram
username · name · profilePictureUrlProfile data
messagingAccessWhether the account can send DMs through the API
missingScopesPermissions 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}/reply

Scope 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-reply

Scope 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}/hide

Scope 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/messages

Scope 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

StatuscodeWhen
400(no code)Invalid field or commentId in the wrong format
404NOT_FOUNDconnectionId is not an account of this workspace
422META_ERRORMeta rejected it: sending limit, missing permission, outside the 24-hour window or comment already replied to. The message has the reason

Frequently asked questions

See also

On this page