Update WhatsApp Status Story Using The API

September 18, 2024

Automate your WhatsApp status to keep your contacts/customers updated with your latest news

Updating your WhatsApp status is more than just a fun feature, it’s a powerful tool for staying connected and engaging with your contacts.

🤩 🤖 Wassenger is a complete communication platform and API solution for WhatsApp. Explore more than 100+ API use cases and automate anything on WhatsApp by signing up for a free trial and getting started in minutes!

Whether you’re sharing a quick update, an inspirational message, or a lighthearted moment, regularly updating your status helps maintain relationships and keeps your network informed. Like Instagram Stories or Snapchat, WhatsApp status allows you to share fleeting moments that disappear after 24 hours, creating a sense of immediacy and connection. For businesses and individuals alike, an active WhatsApp status can enhance communication and add a personal touch to daily interactions.

Note: WhatsApp status API feature is only available in the Platform plans. If you want to use it, please upgrade your plan.

Requirements

API endpoint

We will use the following API endpoint to update the WhatsApp status:

Prepare the request

Target API URL using the POST method

https://api.wassenger.com/v1/chat/{deviceId}/status

Required HTTPS headers > Obtain your API key here

Content-Type: application/json
Token: $API_TOKEN

Use the body in JSON format for an image update

{
  "message": "This is a image caption message that can also include links: https://youtube.com",
  "media": {
    "url": "https://picsum.photos/seed/picsum/600/400"
  }
}

Use the body in JSON format for a video update

{
  "message": "This is a video caption message that can also include links: https://youtube.com",
  "media": {
    "url": "https://download.samplelib.com/mp4/sample-5s.mp4"
  }
}

🖥️ Looking for a code example? Go to the API live tester and get ready-to-use code examples in 15+ programming languages, including Python, JavaScript, PHP, C#, Java, Ruby, Go, Powershell, cURL and more.

🤩 🤖 Wassenger is a complete API solution for WhatsApp. Sign up for a 7-day free trial and get started in minutes!

Upload the status using code

Explore how to use the code in your browser without installing any software.

Also, you can find different languages you can test on Replit.com:

Post an image

# Examples requires to have installed requests Python package.
# Install it by running: pip install requests
import requests
url = "https://api.wassenger.com/v1/chat/66d1a54430541033/status"
payload = {
"message": "This is a image caption message that can also include links: https://youtube.com", 
"media": { "url": "https://picsum.photos/seed/picsum/600/400" }
}
headers = {
"Content-Type": "application/json", 
"Token": "API TOKEN GOES HERE"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

Post a video

# Examples requires to have installed requests Python package.
# Install it by running: pip install requests
import requests
url = "https://api.wassenger.com/v1/chat/66d1a54430541033/status"
payload = {
"message": "This is a image caption message that can also include links: https://youtube.com", 
"media": { "url": "https://download.samplelib.com/mp4/sample-5s.mp4" }
}
headers = {
"Content-Type": "application/json", 
"Token": "API TOKEN GOES HERE"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

Post an image

# Examples requires to have installed requests Python package.
# Install it by running: pip install requests
<?php
$curl = curl_init();
curl_setopt_array($curl, [
  CURLOPT_URL => 'https://api.wassenger.com/v1/chat/66d1a544305410/status',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => json_encode([
    'message' =>
      'This is a image caption message that can also include links: https://youtube.com',
    'media' => [
      'url' => 'https://picsum.photos/seed/picsum/600/400',
    ],
  ]),
  CURLOPT_HTTPHEADER => [
    'Content-Type: application/json',
    'Token: API TOKEN GOES HERE',
  ],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
  echo 'cURL Error #:' . $err;
} else {
  echo $response;
}

Post a video

# Examples requires to have installed requests Python package.
# Install it by running: pip install requests
<?php
$curl = curl_init();
curl_setopt_array($curl, [
  CURLOPT_URL => 'https://api.wassenger.com/v1/chat/66d1a5443054103/status',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => json_encode([
    'message' =>
      'This is a video caption message that can also include links: https://youtube.com',
    'media' => [
      'url' => 'https://download.samplelib.com/mp4/sample-5s.mp4',
    ],
  ]),
  CURLOPT_HTTPHEADER => [
    'Content-Type: application/json',
    'Token: API TOKEN GOES HERE',
  ],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
  echo 'cURL Error #:' . $err;
} else {
  echo $response;
}

Post an image

// Examples requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.
// Install it by running: pecl install pecl_http
// More information: https://pecl.php.net/package/pecl_http/3.2.0
<?php
$client = new http\Client();
$request = new http\Client\Request();
$body = new http\Message\Body();
$body->append(
  json_encode([
    'message' =>
      'This is a video caption message that can also include links: https://youtube.com',
    'media' => [
      'url' => 'https://picsum.photos/seed/picsum/600/400',
    ],
  ])
);
$request->setRequestUrl(
  'https://api.wassenger.com/v1/chat/66d1a54430541033/status'
);
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
  'Content-Type' => 'application/json',
  'Token' => 'API TOKEN GOES HERE',
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();

Post a video

# Examples requires to have installed requests Python package.
# Install it by running: pip install requests
// Examples requires to have installed pecl_http package, a simple and elegant HTTP client for PHP.
// Install it by running: pecl install pecl_http
// More information: https://pecl.php.net/package/pecl_http/3.2.0
<?php
$client = new http\Client();
$request = new http\Client\Request();
$body = new http\Message\Body();
$body->append(
  json_encode([
    'message' =>
      'This is a video caption message that can also include links: https://youtube.com',
    'media' => [
      'url' => 'https://download.samplelib.com/mp4/sample-5s.mp4',
    ],
  ])
);
$request->setRequestUrl(
  'https://api.wassenger.com/v1/chat/66d1a54430541033/status'
);
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
  'Content-Type' => 'application/json',
  'Token' => 'API TOKEN GOES HERE',
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();

Post an image

// This code requires you to have installed Unirest package.
// Documentation: https://kong.github.io/unirest-java/#requests
// Installation: http://kong.github.io/unirest-java/
HttpResponse<String> response = Unirest.post("https://api.wassenger.com/v1/chat/66d1a54430541033/status")
.header("Content-Type", "application/json")
.header("Token", "API TOKEN GOES HERE")
.body("{\"message\":\"This is a image caption message that can also include links: https://youtube.com\", \"media\":{\"url\":\"https://picsum.photos/seed/picsum/600/400\"}}")
.asString();

Post a video

// This code requires you to have installed Unirest package.
// Documentation: https://kong.github.io/unirest-java/#requests
// Installation: http://kong.github.io/unirest-java/
HttpResponse<String> response = Unirest.post("https://api.wassenger.com/v1/chat/66d1a5443054103/status")
.header("Content-Type", "application/json")
.header("Token", "API TOKEN GOES HERE")
.body("{\"message\":\"This is a video caption message that can also include links: https://youtube.com\", \"media\":{\"url\":\"https://download.samplelib.com/mp4/sample-5s.mp4\"}}")
.asString();

Need more? Explore all our WhatsApp status examples and go all in!

🤩 🤖 Wassenger is a complete communication platform and API solution for WhatsApp. Explore more than 100+ API use cases and automate anything on WhatsApp by signing up for a free trial and getting started in minutes!

Live testing the file upload using the API

Explore our API live tester

FAQs

How status update processing works

  • By default, WhatsApp status updates are processed in real-time unless specified as scheduled or delayed.
  • When status updates are scheduled, they are stored in a queue in a non-strict first-in-first-out (FIFO) order.
  • Strict order can be enforced by specifying the order = true field in JSON payload (example).

Can you use template variables in status messages?

No, template variables syntax is not supported in user status messages.

I have multiple numbers connected: how to send messages through a specific number?

If you have multiple numbers connected to your account, you need to specify the device field in the JSON body with the target WhatsApp number device ID (24 characters hexadecimal value) you want to send the messages through.

If the device field is not specified, messages will be sent through the first connected WhatsApp number in your account.

Here is an example of how to send a message through a specific WhatsApp number

How to send messages to multiple phone numbers

You have to send multiple API requests, one per target phone number.

For instance, if you want to send a message to 10 phone numbers, you should send 10 independent HTTPS requests to the API.

There is no option to send multiple messages in a single API request.

How to validate if a phone number can receive WhatsApp messages

You can validate if a given phone number is linked to a WhatsApp account and can receive messages.

The API provides an endpoint that can validate whether a given phone number exists in WhatsApp or not.

The only requirement is to have at least one WhatsApp number connected to the platform in your current account.

For more details, please check out the API endpoint documentation here.

Before you check if a phone number exists on WhatsApp, you can also validate and normalize the format of a list of phone numbers by using the numbers validator API endpoint. This endpoint only validates the correct E164 format, but it does not check whether the phone number effectively exists on WhatsApp.

Note: The number of WhatsApp check validations is limited per month based on your subscription plan. Please check out the pricing table for more details about the limits.

Looking for more answers? Check out the extended FAQs.

Further useful resources

API Documentation

For more details about the endpoint API, please check the documentation where you will find all the details about the accepted request params, possible success or error responses and ready-to-use code examples in multiple programming languages:

https://app.wassenger.com/docs/#tag/User-Status/operation/getUserStatus

Ready to transform your WhatsApp communication?

Start automating your customer interactions today with Wassenger

Get Started Free