Set WhatsApp Text Status
This endpoint will let you set an ephemeral text status on your WhatsApp account with optional styling parameters like background color and font.
This status will show up as an update similar to Instagram statuses.
Parameters
These parameters should be sent as JSON payload in the request body.
| Field | Description | Example values |
|---|---|---|
text | The text content of the status | oiko! |
params | Optional styling parameters | { "backgroundColor": "#0275d8", "font": 10 } |
params.backgroundColor | Background color as a hex code | #0275d8 |
params.font | Font style identifier | 10 |
Invocation
Make a POST request to https://api.p.2chat.io/open/whatsapp/set-text-status/<number> where <number> is the phone number that you have connected to 2Chat.
- cURL
- Python
- JavaScript
- PHP
curl --location --request POST 'https://api.p.2chat.io/open/whatsapp/set-text-status/+5491124837650' \
--header 'X-User-API-Key: your_api_key_here' \
--header 'Content-Type: application/json' \
--data-raw '{
"text": "oiko!",
"params": { "backgroundColor": "#0275d8", "font": 10 }
}'
import requests
import json
url = "https://api.p.2chat.io/open/whatsapp/set-text-status/+5491124837650"
payload = json.dumps({
"text": "oiko!",
"params": { "backgroundColor": "#0275d8", "font": 10 }
})
headers = {
'X-User-API-Key': 'your_api_key_here',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
var axios = require('axios');
var data = JSON.stringify({
"text": "oiko!",
"params": { "backgroundColor": "#0275d8", "font": 10 }
});
var config = {
method: 'post',
url: 'https://api.p.2chat.io/open/whatsapp/set-text-status/+5491124837650',
headers: {
'X-User-API-Key': 'your_api_key_here',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.p.2chat.io/open/whatsapp/set-text-status/+5491124837650',
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 =>'{
"text": "oiko!",
"params": { "backgroundColor": "#0275d8", "font": 10 }
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'X-User-API-Key: your_api_key_here'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Response
The API will return whether it succeded or not to queue the request for processing
{
"success": true,
}