Start Typing Indicator
Show the typing indicator in a WhatsApp conversation
Start Typing Indicator
Show the typing indicator in a WhatsApp conversation. This will display "typing..." to the recipient.
Endpoint
POST /startTyping
Headers
Name | Type | Required | Description |
---|---|---|---|
Authorization | string | Yes | Bearer token for authentication |
Content-Type | string | Yes | application/json |
Request Body
Field | Type | Required | Description |
---|---|---|---|
session | string | Yes | The session ID |
to | string | Yes | Recipient's phone number or group JID (e.g., "+1234567890" or "groupId@g.us") |
Response
{
"success": true
}
Response Fields
Field | Type | Description |
---|---|---|
success | boolean | Whether the operation was successful. |
Examples
curl -X POST "https://api.wasend.dev/startTyping" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"session": "sessionId",
"to": "+1234567890"
}'
import { WasendClient } from '@wasend/core';
const client = new WasendClient({
apiKey: 'YOUR_API_KEY',
baseUrl: 'https://api.wasend.dev'
});
// Start typing indicator
await client.startTyping({
session: "sessionId",
to: "+1234567890"
});
const { WasendClient } = require('@wasend/core');
const client = new WasendClient({
apiKey: 'YOUR_API_KEY',
baseUrl: 'https://api.wasend.dev'
});
// Start typing indicator
await client.startTyping({
session: "sessionId",
to: "+1234567890"
});
from wasend import WasendClient
client = WasendClient(
api_key='YOUR_API_KEY',
base_url='https://api.wasend.dev'
)
# Start typing indicator
client.start_typing(
session="sessionId",
to="+1234567890"
)
package main
import (
"fmt"
"log"
"github.com/wasenddev/wasend-sdk-go/wasendcore"
)
func StringPtr(s string) *string { return &s }
func main() {
client := wasendcore.NewWasendClient(&wasendcore.WasendConfig{
ApiKey: StringPtr("YOUR_API_KEY"),
BaseUrl: StringPtr("https://api.wasend.dev"),
})
// Start typing indicator
err := client.StartTyping(&wasendcore.ChatRequest{
Session: StringPtr("sessionId"),
To: StringPtr("+1234567890"),
})
if err != nil {
log.Fatal(err)
}
fmt.Println("Typing indicator started successfully")
}
using Wasend.Core;
var config = new WasendConfig
{
ApiKey = "YOUR_API_KEY"
};
var client = new WasendClient(config);
// Start typing indicator
client.StartTyping(new ChatRequest
{
Session = "sessionId",
To = "+1234567890"
});
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import org.json.JSONObject;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient httpClient = HttpClient.newHttpClient();
JSONObject requestBody = new JSONObject();
requestBody.put("session", "sessionId");
requestBody.put("to", "+1234567890");
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.wasend.dev/startTyping"))
.header("Authorization", "Bearer YOUR_API_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(requestBody.toString()))
.build();
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("Response: " + response.body());
}
}
<?php
$url = 'https://api.wasend.dev/startTyping';
$data = [
'session' => 'sessionId',
'to' => '+1234567890'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
require 'net/http'
require 'uri'
require 'json'
uri = URI('https://api.wasend.dev/startTyping')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.request_uri)
request["Authorization"] = "Bearer YOUR_API_KEY"
request["Content-Type"] = "application/json"
request.body = {
session: "sessionId",
to: "+1234567890"
}.to_json
response = http.request(request)
puts "Response: #{response.body}"
import Foundation
let url = URL(string: "https://api.wasend.dev/startTyping")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer YOUR_API_KEY", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
let body: [String: Any] = [
"session": "sessionId",
"to": "+1234567890"
]
request.httpBody = try? JSONSerialization.data(withJSONObject: body)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data, let responseString = String(data: data, encoding: .utf8) {
print("Response: \(responseString)")
}
}
task.resume()
use reqwest;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let response = client
.post("https://api.wasend.dev/startTyping")
.header("Authorization", "Bearer YOUR_API_KEY")
.header("Content-Type", "application/json")
.json(&json!({
"session": "sessionId",
"to": "+1234567890"
}))
.send()
.await?
.text()
.await?;
println!("Response: {}", response);
Ok(())
}
Error Codes
Code | Description |
---|---|
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid or missing API key |
404 | Not Found - Session or chat not found |
429 | Too many requests - Rate limit exceeded |
500 | Internal server error |
Notes
- Phone numbers must be in international format (e.g., "+1234567890") or a group JID for groups.
- The @c.us suffix (for contacts) or @g.us (for groups) is automatically added by the API if not provided for the
to
field. - The typing indicator will automatically stop after a few seconds or when a message is sent/received.
- Call
/stopTyping
to manually clear the indicator. - For group chats, the typing indicator will show your name followed by "typing..."