SendComment#
Beta version
The functionality is in beta. Features may change and may also work unstably.
The method sends a comment to a post. With the parentCommentId field the same method sends a reply to a comment - there is no separate method for replies.
The method uses the limits on the number of requests per second.
Request#
To send a comment, you have to execute a request at:
POST
{{apiUrl}}/waInstance{{idInstance}}/sendComment/{{apiTokenInstance}}
For apiUrl, idInstance and apiTokenInstance request parameters, refer to the Before you start section.
Request parameters#
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
postId | string | Yes | The identifier of the post the comment is sent to |
message | string | Yes | The text of the comment. The maximum length is 2200 characters |
parentCommentId | string | No | The comment a reply is sent to |
Request body example#
Send a comment to a post:#
{
"postId": "2907515653209522683",
"message": "Great shot!"
}
Send a reply to a comment:#
{
"postId": "2907515653209522683",
"message": "Thank you!",
"parentCommentId": "17912345678901234"
}
Response#
Response parameters#
| Field | Type | Description |
|---|---|---|
commentId | string | The identifier of the sent comment |
Response body example#
{
"commentId": "17912345678901234"
}
SendComment errors#
For a list of errors common to all methods, refer to the Common errors section
| HTTP code | Error ID | Description |
|---|---|---|
| 400 | Bad Request Validation failed | Validation error |
| 400 | Validation failed. Details: 'message' is required | The text of the comment is not passed |
| 400 | Validation failed. Details: 'message' is not allowed to be empty | An empty text of the comment is passed |
| 400 | Validation failed. Details: 'message' length must be less than or equal to 2200 characters long | The text is longer than 2200 characters |
| 400 | Validation failed. Details: 'parentCommentId' with value 'abc' fails to match the required pattern: /^\d+$/ | The identifier of the comment a reply is sent to must consist of digits |
| 400 | comment flagged as offensive; rewrite the text | Instagram has considered the text offensive |
Request examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/sendComment/{{apiTokenInstance}}"
payload = {
"postId": "2907515653209522683",
"message": "Great shot!"
}
headers = {'Content-Type': 'application/json'}
response = requests.post(url, json=payload, headers=headers)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/sendComment/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"postId": "2907515653209522683",
"message": "Great shot!"
}'