SendTyping#
Beta version
The functionality is in beta mode. Functions can be changed and may also work unstably.
The method is designed to send a notification about typing or recording audio in a chat.
Request#
To send a notification, you need to submit a request to the following address:
POST
{{apiUrl}}/waInstance{{idInstance}}/sendTyping/{{apiTokenInstance}}
For apiUrl
, idInstance
and apiTokenInstance
request parameters, refer to Before you start section.
Request parameters#
Parameter | Type | Mandatory | Description |
---|---|---|---|
chatId | string | Yes | Chat Id |
typingTime | integer | No | Display the time of the message typing notification in the interlocutor's chat. Time is limited by values from 1000 to 20000 milliseconds (from 1 to 20 seconds). If the field is absent, typing will continue for 1000 millisecond (1 second). |
typingType | string | No | Message set type. To send a notification for recording audio, you should send the string recording |
Note
The notification delivery time will consist of the interval between sending messages from the queue (delaySendMessagesMilliseconds
) and the specified typing time (typingTime
).
Request body example#
Sending a typing notification:
{
"chatId": "79876543210@c.us",
"typingTime": 5000
}
Sending audio recording notification:
{
"chatId": "79876543210@c.us",
"typingTime": 5000,
"typingType": "recording"
}
Response#
Response parameters#
Parameter | Type | Description |
---|---|---|
idMessage | string | ID of the sending message |
Response body example#
{
"idMessage": "3EB0C767D097B7C7C030"
}
SendTyping errors#
For a list of errors common to all methods, refer to Common errors section
Request examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/sendTyping/{{apiTokenInstance}}"
payload = {
"chatId": "79876543210@c.us",
"typingTime": 5000
}
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%7B%7BidInstance%7D%7D/sendTyping/%7B%7BapiTokenInstance%7D%7D',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"chatId": "79876543210@c.us",
"typingTime": 5000
}',
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": "79876543210@c.us",
"typingTime": 5000
}'
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("/waInstance{{idInstance}}/sendTyping/{{apiTokenInstance}}")
.header("Content-Type", "application/json")
.body("{\r\n \"chatId\": \"79123456789@c.us\",\r\n \"typingTime\": 5000,\r\n}")
.asString();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "/waInstance%7B%7BidInstance%7D%7D/sendTyping/%7B%7BapiTokenInstance%7D%7D"
method := "POST"
payload := strings.NewReader(`{`+"
"+`
"chatId": "79123456789@c.us",`+"
"+`
"typingTime": 5000`+"
"+`
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}