Skip to content

SendTyping#

Test Postman

The method is intended for sending a typing notification to a chat.

The method uses limits on the request rate per second.

Request#

To send a notification, you need to execute a request at:

POST
{{apiUrl}}/waInstance{{idInstance}}/sendTyping/{{apiTokenInstance}}

To get the apiUrl, idInstance and apiTokenInstance request parameters, refer to the Before you start section.

Request parameters#

Parameter Type Required Description
chatId string Yes Chat identifier
typingTime integer Yes Duration in milliseconds (from 1000 to 20000)
typingType string No Action type.
Possible values:
text - "typing..." (default)
record_voice_note - "recording a voice message..."
upload_voice_note - "sending a voice message..."
record_video_note - "recording a video message..".
upload_video_note - "sending a video message..."
record_video - "recording a video..."
upload_video - "sending a video..."
upload_photo - "sending a photo..."
upload_document - "sending a file..."
choose_sticker - "choosing a sticker..."
choose_location - "choosing a location..."
choose_contact - "choosing a contact..."

Note

The message sending time will consist of the interval for sending messages from the queue (delaySendMessagesMilliseconds), the specified typing time (typingTime) and the file upload time for media messages.

Request body example#

Sending a typing notification#

{
    "chatId": "10000000",
    "typingTime": 10000
}

Sending a voice message recording notification#

{
    "chatId": "-10000000000000",
    "typingTime": 10000, 
    "typingType": "record_voice_note"
}

Sending a video sending notification#

{
    "chatId": "@username",
    "typingTime": 10000, 
    "typingType": "upload_video"
}

Response#

Response body example#

The response body is empty. On success the server responds with 200.

Execution of the method with an error#

{
    "status": false,
    "reason": "Validation failed. Details: typingTime must be between 1000 and 20000 ms"
}

SendTyping errors#

For the list of errors common to all methods, see the Common errors section

HTTP code Error identifier Description
400 Validation failed typingTime must be a number
400 Validation failed typingTime must be greater than or equal to 1000
400 Validation failed typingTime must be less than or equal to 20000

Code examples#

import requests

url = "{{apiUrl}}/waInstance{{idInstance}}/sendTyping/{{apiTokenInstance}}"

payload = {
    "chatId": "10000000",
    "typingTime": 10000
}
headers = {
'Content-Type': 'application/json'
}

response = requests.post(url, json=payload, headers=headers)

print(response.text.encode('utf8'))
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => '/waInstance/waInstance%7B%7BidInstance%7D%7D/sendTyping/%7B%7BapiTokenInstance%7D%7D',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_TelegramREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
    "chatId": "10000000",
    "typingTime": 10000
}',
CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json'
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
curl --location -g --request POST '/waInstance{{idInstance}}/sendTyping/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "chatId": "10000000",
    "typingTime": 10000
}'
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("/waInstance{{idInstance}}/sendTyping/{{apiTokenInstance}}")
.header("Content-Type", "application/json")
.body("{\r\n    \"chatId\": \"10000000\",\r\n    \"typingTime\": 10000,\r\n}")
.asString();