Skip to content

Instagram comment automation DM

An Instagram comment automation DM delivers an automatic Instagram DM whenever a fresh comment matches your trigger. Scope can cover a single item or the full connected account, with an optional visible reply beside the private message. Below you will connect Instagram, pick a target, build the rule, and verify it using a separate account.

Instagram comment automation DM — overview

This Instagram comment automation reacts to incoming comments by opening a direct message thread with the commenter. Operators may limit it to one item or apply it across all items from a linked profile, and may optionally post a visible response as well. Support is limited to Instagram Business and Creator accounts, so personal profiles and other networks fall outside this workflow. After creation the rule is active immediately, event subscription is handled automatically, and matching plus delivery run without manual intervention.

1. Connect Instagram

Begin by obtaining an authorization address through the request titled Request an Instagram authorization URL. Send the visitor to the url value returned in the response. Once authorization finishes, retrieve linked profiles via list the connected accounts, then store the Instagram integration identifier for later use as accountId. Both instagram_business_manage_comments and instagram_business_manage_messages must be granted. When either is absent, reconnect the profile so the missing permission can be added. Checking both permissions early prevents a later setup failure where comment-triggered messaging cannot be configured.

2. Choose a post

For a single-item rule, fetch eligible items with the request titled List eligible Instagram posts for one account. Record the chosen item identifier and reuse it as platformPostId. Account-wide coverage needs no such lookup. Double-check that platformPostId and accountId belong together, since pairing an item from another profile is a common cause of a rule that never fires.

3. Create the automation

Build the rule using the request titled Create a comment automation for one post. In that illustration, a comment containing the whole word link or guide on the selected item produces both a private message and a visible reply. The field map below details every option, including how postScope, keywords, excludeKeywords, and publicReplies alter behavior. New rules begin active. Comments authored by the linked profile itself are skipped. When multiple rules qualify for one comment, the most specific rule takes precedence, so overlapping rules should be kept narrow and distinct.

4. Test the automation

Verification requires a second profile: leave a comment containing a trigger term from an account other than the linked one. Check that the commenter receives the private message and, where configured, that the visible reply shows under the comment. If nothing arrives, confirm the test used a different account, the wording satisfies the configured matchMode, no excluded term is present, and the rule targets the item where the comment appeared. Full request and response details are in the Create Comment Automation API reference, with update or pause an automation and review delivery logs available as follow-up actions.

Create comment automation fields
FieldMeaning
accountIdThe Instagram integration id saved after connecting Instagram.
nameA label for the automation, for example Send the guide.
postScopespecific to target one post, or any to watch every post on the account.
platformPostIdThe Instagram post id saved from the eligible-posts list. Omit it when postScope is any.
keywordsTrigger words or phrases. Leave empty to match every new comment.
matchModeMatching mode, for example word in the worked example.
excludeKeywordsWords or phrases that cause a comment to be ignored even if it matches a keyword.
publicRepliesOptional public replies posted below the comment. Set to an empty array to send only the DM.
dmMessageThe direct-message text sent to the commenter, for example Here is the guide: https://example.com/guide.

Field meanings are taken from the source guide; response shapes and status codes were not supplied and are not shown here.

Failure and permission checks
CheckExpected result or remedy
Account type is a personal account or a non-Instagram platformNot supported. Use an Instagram Business or Creator account.
instagram_business_manage_comments is missingReconnect the account to grant the permission.
instagram_business_manage_messages is missingReconnect the account to grant the permission.
Test comment is from the connected account itselfIgnored by design. Test from a different Instagram account.
Comment contains an excludeKeywords entryIgnored even if it matches a keyword.
Several automations match one commentOnly the most specific automation runs.

Only the account-type and permission conditions stated in the source are listed; no error codes were supplied.

Request an Instagram authorization URL
curl {{API_BASE_URL}}/v1/connect/instagram \
  -H "x-access-key: YOUR_ACCESS_KEY"
List eligible Instagram posts for one account
curl "{{API_BASE_URL}}/v1/comment-automations/posts?accountId=INTEGRATION_ID" \
  -H "x-access-key: YOUR_ACCESS_KEY"
Create a comment automation for one post
curl -X POST {{API_BASE_URL}}/v1/comment-automations/ \
  -H "x-access-key: YOUR_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "accountId": "INTEGRATION_ID",
    "name": "Send the guide",
    "postScope": "specific",
    "platformPostId": "INSTAGRAM_POST_ID",
    "keywords": ["link", "guide"],
    "matchMode": "word",
    "publicReplies": ["Sent you a DM!"],
    "dmMessage": "Here is the guide: https://example.com/guide"
  }'