How to manually manage comments
It works when Instagram is enabled
Configuring a response to an Instagram callback
You need to toggle the switch in the connected Instagram account within the Messengers section to enable your bot to respond to comments.

If Instagram displays "Reconnect to work with comments" under your Official Instagram connection, you need to reconnect Instagram to update the necessary permissions. To do this, click the trash icon in the lower right corner (delete bot).

Connect the Instagram account again. How to connect Instagram, see here.
When publishing posts as a co-author, all comment notifications will be sent to the account from which you create the post.
When a user comments on a post, a callback is sent to the bot (you can view it in the "Clients" section within the user's dialog).
The callback has the format: client_wall_reply_new link id: text
where:
linkis the post linkidis the record IDtextis the comment text

We can work with comments in two ways: reply with your comment or write one message in Direct.
client_wall_reply_new - is a common part of the callback.
client_wall_reply_new_comment - if we are interested in comments only on the post
client_wall_reply_new_live - if the comments are only during live broadcast
How to set up an auto-reply to comments in Direct
Аutomatic response to a comment does NOT open a 24-hour window.
Copy the callback and go to the Funnel Constructor section. Create a block of the type "Primary condition check" or "Non-state condition" and paste the copied callback into the condition. We are setting up a check "For the presence of keywords"
ATTENTION! It is not recommended to use numbers as a trigger for launching a bot. The post ID can contain these numbers. The bot can respond to any callback that contains these numbers if it chooses a match based on the presence of keywords.
If you want to set up a reaction to comments under any post for any comment, then in the terms you specify only client_wall_reply_new_comment.
During selecting a match, it sets “Keyword match".

Important note:
We recommend using the "Keyword match" search type when setting up a callback response.
Remember, the matching logic for a block's condition should be chosen according to your project's settings and requirements. Therefore, be sure to test your chatbot flow thoroughly!
Read about choosing a match in the block condition in the article "Trigger and match type".
If you plan to set up a reaction to a specific post, include client_wall_reply_new_comment followed by the post ID in the trigger field.
ATTENTION!
It is not recommended to use numbers as triggers to launch your bot.
A post ID often consists of numbers. If your bot uses keyword-based matching, it might incorrectly respond to any callback containing those numbers.

If you plan to set up a reaction to a specific post, include client_wall_reply_new_comment followed by the post ID in the trigger field.
ATTENTION!
It is not recommended to use numbers as triggers to launch your bot.
A post ID often consists of numbers. If your bot uses keyword-based matching, it might incorrectly respond to any callback containing those numbers.

In the reply field, enter the text you want to send as a response to this comment.

Above the message, it indicates that it was sent in response to a comment. If you click on "View post", you will be redirected to the post you commented on.

If a user leaves a comment that you haven't configured a response for (or if you haven't set up any responses), you can reply to them with a single Direct Message in the "Clients" section.
However, if you try to send the user another Direct Message, the second message will not be delivered because responding to a comment does not reopen the 24-hour messaging window.
How to use direct Instagram post links when working with comments
When a user comments on a post, a notification appears in the chat within the Clients section containing the comment text, and the instagram_media_url variable is generated with a link to the publication.

You can use the instagram_media_url variable to set up reactions to comments on specific Instagram posts.
Let's look at an example.
Setting up different responses based on which post was commented on
Task: The account has several posts, including three featuring products at different prices. Configure responses to comments on these three posts to reply with the exact price. For all other posts, respond with "By agreement." The response should be sent both as a Direct Message and as a comment under the post.
Solution:
Set up keyword-based reactions for comments on the posts. This means the bot will react to any post where a comment contains the specified keywords.
Use the
insta_create_commentfunction in the Calculator to post a comment under the relevant post, while also setting the response text in the Message text field to send a Direct Message. This allows the user to receive the price simultaneously in both the comments and Direct Messages.If a comment containing the keywords appears under any other post, the user will receive a message saying "by agreement."

Step 1. In the Start block trigger field, enter client_wall_reply_new followed by the keywords you want to trigger a response. Set the match type to "Keyword match".
Example to copy:
client_wall_reply_new_comment (price|how many|cost|find out)
Step 2. In the "Calculator" field, declare a text variable. Its value is determined by an IF condition that checks the instagram_media_url variable.
Example to copy (remember to replace the links with your actual post URLs). You can copy the URL from the instagram_media_url variable in the client's chat (Clients section) after they comment on the relevant post:
text = if(instagram_media_url == "https://www.instagram.com/reel/Cagzkx", "$10", if(instagram_media_url == "https://www.instagram.com/p/CqvCq4", "$29", if(instagram_media_url == "https://www.instagram.com/p/CocLhN", "$35", "Other")))
Step 3. Use the insta_create_comment method to post a comment.
Example to copy:
insta_create_comment("#{text}")
where #{text} is the response text we send to the user.
Step 4. In the Message text field, enter the variable containing the response for the Direct Message.
In this example, the variable is #{text}. The same response is posted as a comment and duplicated in the Direct Message. You can configure different responses for each if needed.

How to post a comment in response to a message under a post or during a live broadcast
Step 1. In the Clients section, copy the callback (notification) indicating a comment has been posted, then navigate to the Builder.

Step 2. Create a "Start" or "Trigger" block and paste the copied callback into the Trigger field.

There are several ways to configure the bot's trigger condition.
In this example, the bot responds to comments under all posts with the message "reply in comments." To set this up, enter the main callback prefix and the keyword in the condition field:
client_wall_reply_new_comment reply in comments
Important: set the matching type to "Keyword match".
ATTENTION!
It is not recommended to use numbers as triggers to launch your bot.
A post ID often consists of numbers. If your bot uses keyword-based matching, it might incorrectly respond to any callback containing those numbers.
There is one specific behavior for live broadcast callbacks (client_wall_reply_new_live): the bot will only react during the live broadcast. Once the live broadcast ends, the bot will no longer detect comments under it and will not be able to respond.

Step 3. In the response field, enter #{none}.
Step 4. In the "Calculator" field, write:
insta_create_comment("your comment text response")
Your comment text should be placed inside the parentheses.
Then, click "Done".
With this configuration, as in the example, the bot-generated comment will be posted in response to any comment under a post containing the keywords "reply in the comments".
Example of a bot's response to a comment in the comments.

The bot's response to ANY comment under ANY post.
If you enter only the general callback prefix client_wall_reply_new in the "Trigger" field, your comment will be posted in response to comments under all posts (regardless of the text the user wrote).

The bot's response to A SPECIFIC PHRASE under ANY post.
If you leave in the "Trigger" field client_wall_reply_new and the keyword, then your comment will be sent in response to the comments with the keyword under all posts.

The bot's response to A SPECIFIC PHRASE under A SPECIFIC post.
Copy the full callback from the clients section and put it in the Start block field:

You can respond to comments that users leave during a live broadcast (there is a separate key for it client_wall_reply_new_live).
There is one special feature for live broadcasts: the bot will react only during the broadcast. If the broadcast is over, the bot will not see the comments under this broadcast and can not respond.
How to save comment text to a variable
To save the text of a user's comment, use the comment_text() function.
Insert the callback client_wall_reply_new in the Trigger field. Then, in the "Calculator" field, assign the text to a variable—for example, comm (you can use any other name):
comm = comment_text()
Next, click "Add condition" in the calculator and specify:
comm = comment_text()


How to delete a comment
The function insta_delete_comment(comment_id) deletes a comment.
If comment_id is not provided, the function uses the client variable instagram_last_comment_id.
On success, it returns {"success":true}. If a non-existent comment_id is provided, it returns {"An unexpected error has occurred. Please retry your request later."}.
Working with account mentions
How to mention in media
When a user tags your profile in their post, your bot will receive the following callback:

The following variables appear:

mention_caption — post caption
post_url — post link
mention_comments_count — number of comments
mention_like_count — number of likes
mention_media_id — post id
Let's configure a reaction to respond to a mention.
To do this, create a "Primary Condition Check" or "State with Condition" block. In the "Condition" field, enter mention_in_media and set the match type to "Keyword match".
In the "Calculator" field, enter the following method:
reply_to_mention(text)
where text is the comment that will appear under the mentioned post. You can specify a variable (inserted without quotes inside the parentheses) or enter the text directly (enclosed in quotes).
Example:
Step 1. Go to the builder and create a block with a trigger (Start block or Trigger block). Then, in the Trigger field, specify the callback mention_in_media.

Select "Mention in post" in the trigger list, and as the calculator method, choose "Reply comment to a post". Then, enter the text for the reply comment.
Step 2. Click "Add trigger". The trigger along with the method will then be entered into the block:

How to mention in a comment
When a user tags your account in the comments, the chat will receive a callback like:

The following variables will also appear in the client card:
mention_like_count— number of likesmention_media_id— post ID
Let's configure a reaction to respond to a mention in a comment.
To do this, create a "Start" or "Trigger" block. In the "Condition" field, enter mention_in_comment and set the match type to "Keyword match".
In the "Calculator" field, enter the following method:
reply_to_mention(text)
where text is the comment that will be posted in reply to the mention. You can specify a variable (inserted without quotes inside the parentheses) or enter the text directly (enclosed in quotes).
Example:
Step 1. Go to the builder, create a block with a trigger (Start block or Trigger block), and enter the following callback in the "Trigger" field:

Next, select the condition "Mention in comment".
Step 3. Click on Calculator and in the field that appears, enter the method:
reply_to_mention("Response text for mention in comment")

If the 24-hour window is not open in the chat with the user, you cannot send a direct message in response to the mention. You can only reply with a comment.
If the 24-hour window is open, you can enter text in the Response field, which the user will receive as a direct message after your account is mentioned.
How to mention other profiles in the comments under your posts
If someone is tagged in the comments under your account, the variable mentioned_in_comment is created in the client card.


It stores the person's username who was tagged. If more than two people are tagged, the usernames are stored in an array.


If you need to segment users who have tagged two or more friends, you can assign a variable like len = arr_len(mentioned_in_comment) and then compare that variable with the desired value.
If the 24-hour messaging window is not open in the chat with the user, you cannot send a direct message in response to the mention. You can only reply with a comment.
Last updated