Developer API

Send official WhatsApp Business messages from any app: Laravel, Node.js, Python, Flutter, mobile apps or your own ERP.

API v1

1Base URL and authentication

Every request uses HTTPS and sends your API key as a bearer token in the Authorization header. You find the key in your dashboard under Website connection.

POSThttps://app.tskin.sa/api/v1/send-message.php
HTTP
POST /api/v1/send-message.php HTTP/1.1
Host: app.tskin.sa
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

2Send a template message

Send an approved Meta template, such as an order update, a verification code or an appointment reminder. Templates work at any time, even when the customer hasn't messaged you.

FieldTypeDescription
phonestringRequired Number with country code, digits only, e.g. 966500000000.
message_typestringRequired "template" for templates.
template_namestringRequired The approved template name.
languagestringOptional Template language code, e.g. "ar" or "en_US". Defaults to your account language.
paramsarrayOptional Values for the body variables {{1}}, {{2}}… in order.
Request
{
  "phone": "966500000000",
  "message_type": "template",
  "template_name": "order_update_notice",
  "language": "ar",
  "params": ["10024", "Leather Handbag", "250 SAR"]
}
Response 200
{
  "status": "success",
  "message_id": "wamid.HBgLOTY2...",
  "recipient": "966500000000",
  "type": "template"
}

3Send a text message

Send free text when the customer has messaged you in the last 24 hours. Outside that window WhatsApp only accepts templates.

FieldTypeDescription
phonestringRequiredNumber with country code.
message_typestringOptional"text" (the default).
messagestringRequiredThe message text.
Request
{
  "phone": "966500000000",
  "message_type": "text",
  "message": "Hello! How can we help with your order today?"
}

4Code examples

The same template request in four languages.

Terminal
curl -X POST "https://app.tskin.sa/api/v1/send-message.php" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"phone":"966500000000","message_type":"template","template_name":"order_update_notice","language":"ar","params":["10024","Leather Handbag","250 SAR"]}'

5Signing requests (optional)

For extra protection, sign each request with your API key. When both headers are present, we reject a request whose signature doesn't match or whose timestamp is more than 10 minutes old.

The signature is HMAC-SHA256(body + timestamp, api_key) in hex.

PHP
$body      = json_encode($payload, JSON_UNESCAPED_UNICODE);
$timestamp = (string) time();
$signature = hash_hmac('sha256', $body . $timestamp, $apiKey);

// send these two headers with the request (use the same $body)
// X-Tskin-Timestamp: $timestamp
// X-Tskin-Signature: $signature

6Status codes

Errors return {"status": "error", "message": "…"} with one of these codes:

CodeMeaningWhat to do
200OKThe message was accepted and sent to WhatsApp.
400Bad RequestCheck the JSON, the phone format, and the required fields.
401UnauthorizedThe API key is missing or wrong, or WhatsApp isn't connected on the account.
403ForbiddenThe account is inactive, the subscription expired, or the signature is invalid.
500Server ErrorWhatsApp returned an error (see details) or something failed on our side. Try again.

Need help with the integration? support@tskin.sa

Email us