Skip to content

Set Disappearing Chat Test#

The method is aimed for changing settings of disappearing messages in chats. The standard settings of the application are to be used: 0 (off), 86400 (24 hours), 604800 (7 days), 7776000 (90 days).


To set settings, you have to execute a request at:


For apiUrl, idInstance and apiTokenInstance request parameters, refer to Before you start section.

Request parameters#

Parameter Type Mandatory Description
chatId string Yes Correspondent id
ephemeralExpiration integer Yes Messages lifetime in chats, takes on the values in seconds: 0, 86400, 604800, 7776000

Request body example#

    "chatId": "",
    "ephemeralExpiration": 0


Response parameters#

Parameter Type Description
chatId string yes
disappearingMessagesInChat boolean Chat state (disappearing or plain), takes on the values: true, false
ephemeralExpiration integer Messages lifetime in chats, takes on the values in seconds: 0, 86400, 604800, 7776000

Response body example#

    "chatId": "",
    "disappearingMessagesInChat": false,
    "ephemeralExpiration": 0

SetDisappearingChat errors#

For a list of errors common to all methods, refer to Common errors

Request examples#

import requests
import json

url = "{{apiUrl}}/waInstance{{idInstance}}/setDisappearingChat/{{apiTokenInstance}}
payload = json.dumps({
  "chatId": "",
  "ephemeralExpiration": 0
headers = {
  'Content-Type': 'application/json'

response = requests.request("POST", url, headers=headers, data=payload)

curl --location '{{apiUrl}}/waInstance{{idInstance}}/setDisappearingChat/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "chatId": "",
    "ephemeralExpiration": 0
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();

var headers = new HttpHeaders();

var jsonBody = "{\"chatId\": \"\",\"ephemeralExpiration\": 0}";

var requestEntity = new HttpEntity<>(jsonBody, headers);

var response =, HttpMethod.POST, requestEntity, String.class);
var requestUrl = new StringBuilder();

var response =
    .header("Content-Type", "application/json")
    .body("{\"chatId\": \"\",\"ephemeralExpiration\": 0}")

Sub SetDisappearingChat()
    Dim url As String
    Dim RequestBody As String
    Dim http As Object
    Dim response As String

    ' The apiUrl, idInstance and apiTokenInstance values are available in console, double brackets must be removed
    url = "{{apiUrl}}/waInstance{{idInstance}}/setDisappearingChat/{{apiTokenInstance}}"

    ' ChatId — ID of the chat in which you need to change the settings ( for private chats, for group chats), ephemeralExpiration - Message lifetime in seconds, takes values: 0, 86400, 604800, 7776000
    RequestBody = "{""chatId"":"""", ""ephemeralExpiration"": ""0""}"

    Set http = CreateObject("MSXML2.XMLHTTP")

    With http
        .Open "POST", url, False
        .setRequestHeader "Content-Type", "application/json"
        .Send RequestBody
    End With

    response = http.responseText

    Debug.Print response

    ' Outputting the answer to the desired cell
    Range("A1").Value = response

    Set http = Nothing
End Sub