Wow! Build your WhatsApp integration. Start free. Register Now
WhatsApp API

A one-day discount in a WhatsApp status until midnight

Shop contacts can open a discount that works only from this status and ends at midnight. When that one-day window starts, your backend publishes the product image through Whapi.Cloud. This use case shows integrators how to implement that flow through the WhatsApp API.

Your backend owns the hidden URL One media post on the shop number
A shop phone showing a WhatsApp Status with a product image for a one-day discount that ends at midnight.
Decorartive bubble
Use case

When to use this flow

The discount ends at midnight

Use this flow when the offer is a one-day discount and your backend expires the link at midnight.

The link is valid only from the status

Use this flow when the link works only from this status, and a forwarded chat must not redeem the offer.

The status is a product image

Use this flow when the status carries a product image, not a countdown that tells viewers when a drop starts.

WhatsApp Status on a phone showing the product image for a discount the viewer can open before midnight.
Customer experience

Viewers open the discount from Status

Before automation, the discount link is forwarded into chats and opened without the status, and staff forget to expire it at midnight.

After the flow runs, people who see the status can open a discount that works only from that status and ends at midnight. Integrators build this result with the WhatsApp API.

Workflow

From the window start to one publish

1

Discount window starts

Your backend opens the one-day window, builds the status-only URL, and sets that link to expire at midnight.

2

Publish the product image

POST /stories/send/media

createStoryMedia posts that product image to the shop number's status. The hidden URL and the midnight cutoff stay in your backend.

Prerequisites

Before you run the flow

Connect the shop WhatsApp number that publishes the status, and authenticate every request with that number's API token. The discount window, the hidden URL, and the midnight expiry stay in your backend.

Optional — go deeper for this flow

API implementation

Publish the product image

Your backend already holds the product image and the link that works only from this status. This step publishes that image on the shop number when the one-day window starts.

Get your API token for free after you register on whapi.cloud, and use that token in the code instead of Your_Token from the examples.

Publish the product image

Post the product image to the shop status so viewers can open the discount your backend accepts only from that status until midnight.

curl --request POST \
     --url https://gate.whapi.cloud/stories/send/media \
     --header 'accept: application/json' \
     --header 'authorization: Bearer Your_Token' \
     --header 'content-type: application/json' \
     --data '
{
  "media": "https://example.com/product.jpg"
}
'
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://gate.whapi.cloud/stories/send/media",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\"media\":\"https://example.com/product.jpg\"}",
  CURLOPT_HTTPHEADER => [
    "accept: application/json",
    "authorization: Bearer Your_Token",
    "content-type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import requests

url = "https://gate.whapi.cloud/stories/send/media"

payload = {
  "media": "https://example.com/product.jpg"
}
headers = {
    "accept": "application/json",
    "authorization": "Bearer Your_Token",
    "content-type": "application/json",
}

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

print(response.text)
const url = 'https://gate.whapi.cloud/stories/send/media';

const response = await fetch(url, {
  method: 'POST',
  headers: {
    accept: 'application/json',
    authorization: 'Bearer Your_Token',
    'content-type': 'application/json',
  },
  body: JSON.stringify({
    media: 'https://example.com/product.jpg',
  }),
});

console.log(await response.text());
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"media\":\"https://example.com/product.jpg\"}");
Request request = new Request.Builder()
  .url("https://gate.whapi.cloud/stories/send/media")
  .post(body)
  .addHeader("accept", "application/json")
  .addHeader("authorization", "Bearer Your_Token")
  .addHeader("content-type", "application/json")
  .build();

Response response = client.newCall(request).execute();
using RestSharp;

var options = new RestClientOptions("https://gate.whapi.cloud/stories/send/media");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
request.AddHeader("authorization", "Bearer Your_Token");
request.AddHeader("content-type", "application/json");
request.AddStringBody("{\"media\":\"https://example.com/product.jpg\"}", DataFormat.Json);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);
package main

import (
	"fmt"
	"io"
	"net/http"
	"strings"
)

func main() {
	body := strings.NewReader(`{"media":"https://example.com/product.jpg"}`)
	req, _ := http.NewRequest("POST", "https://gate.whapi.cloud/stories/send/media", body)
	req.Header.Set("accept", "application/json")
	req.Header.Set("authorization", "Bearer Your_Token")
	req.Header.Set("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()
	out, _ := io.ReadAll(res.Body)
	fmt.Println(string(out))
}
When things break

Handle failures at each step

The discount window can start while the status still fails to publish, so viewers never see the link. Handle that break before you treat the offer as live.

Window started, but the status did not publish?

The channel may be unauthorized, the media rejected, or the file too large. Retry the publish or alert your team, and do not treat the offer as live. Clients often mention that our support is responsive. Do not hesitate to ask for help.

Contact our support if something went wrong

Troubleshoot by API step

Status What it means What to do
400 Wrong request parameters
401 Need channel authorization for posting stories
402 Trial version limit exceeded
403 It is forbidden to send to this group/recipient
404 Media with specified id not found
413 Request media too large
415 Unsupported media type
429 Too many requests
500 Internal Error
FAQ

Questions operators ask

Your backend builds the hidden URL and accepts it only from this status. Whapi.Cloud publishes the product image. It does not check where the viewer opened the link.
Your backend expires the discount link at midnight. A status remains available for up to 24 hours after it is posted. This flow does not delete the status at midnight.
The discount window can start while the publish fails because the channel is unauthorized, the media is rejected, or the file is too large. Retry the publish or alert your team, and do not treat the offer as live.
This flow publishes a product image for a discount that ends at midnight. A countdown that tells viewers when a drop starts is a separate flow.
People who already have the shop number can see a status from that number, including a product image, without a separate chat to each contact.
Supported WhatsApp Features

Everything you need to build WhatsApp automation

Whapi.Cloud gives you access to a complete set of WhatsApp features — messaging, media, groups, channels, webhooks and more. Build bots, automations and integrations without feature limitations.

Chosen by developers

Trusted by 3,300+ developers and SaaS teams

Developers worldwide rely on Whapi.Cloud to build automations, bots, CRM integrations, bulk messaging tools and advanced WhatsApp workflows. Our infrastructure processes millions of API requests with high stability — and grows every month.

Icon of feature

5,5K+

active API channels

Icon of feature

21M+

API requests processed monthly

“Everything is simple, intuitive and easy to navigate. The docs are clear, and all the info I need is right on the screen. Great job.”

roberto k. / Web Developer

“We connected WhatsApp to our workflows using n8n in just a few minutes. No code, no complications- everything worked on the first try.”

Martin p. / Developer

“Whapi.Cloud became a key part of our customer communication. We automated product updates, order notifications and support messages without needing Meta templates or approvals”

Oscar T. / CTO

Decorative bubble