EditComment#
Beta version
The functionality is in beta. Features may change and may also work unstably.
The method edits the text of a comment.
You can edit only a comment sent by the account and only within 15 minutes after it was sent.
If the edit command is sent via the queue, its result arrives as the editCommentStatus notification.
Only on an instance authorized with a login
The method is available to an instance authorized by the Login method.
For an instance with an imported browser session the method responds with 422: comments are not edited via the web.
The method uses the limits on the number of requests per second.
Request#
To edit a comment, you have to execute a request at:
{{apiUrl}}/waInstance{{idInstance}}/editComment/{{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 left under |
commentId | string | Yes | The identifier of the comment |
message | string | Yes | The new text of the comment, up to 2200 characters |
Request body example#
{
"postId": "2907515653209522683",
"commentId": "17912345678901234",
"message": "Corrected comment text"
}
Response#
Response parameters#
| Field | Type | Description |
|---|---|---|
commentId | string | The identifier of the edited comment - in the same form it was in the request |
Response body example#
{
"commentId": "17912345678901234"
}
EditComment 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: 'postId' is required | The post is not specified |
| 400 | Validation failed. Details: 'commentId' is required | The comment is not specified |
| 400 | Validation failed. Details: 'commentId' with value 'abc' fails to match the required pattern: /^\d+$/ | The identifier of the comment must consist of digits |
| 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 | comment is older than 15 minutes and can no longer be edited | More than 15 minutes have passed since the comment was sent |
| 400 | comment flagged as offensive; rewrite the text | Instagram has considered the text offensive |
| 422 | EditComment: not available for a web session | The instance is authorized by importing a browser session: such an instance cannot edit comments |
Request examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/editComment/{{apiTokenInstance}}"
payload = {"postId": "2907515653209522683", "commentId": "17912345678901234", "message": "Corrected comment text"}
headers = {'Content-Type': 'application/json'}
response = requests.post(url, json=payload, headers=headers)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/editComment/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{"postId": "2907515653209522683", "commentId": "17912345678901234", "message": "Corrected comment text"}'