heyita

Heyita API

Send WhatsApp messages, add contacts and read your templates from your own software, and get told the moment something happens. Plain JSON over HTTPS, one header for authentication.

Overview

Every endpoint lives under https://heyita.com/api/v1. Requests and responses are JSON. Phone numbers are digits with the country code and no plus sign or spaces, such as 919876543210.

Messages you send through the API appear in the contact's chat in the team inbox, so your team sees the whole conversation and can take over when the customer replies. The API is part of the Heyita plan, with no per-call fee. Meta bills you directly for delivered messages at its own rates.

Authentication

Send your API key in the Authorization header of every request:

Header
Authorization: Bearer <API key>

Create keys in the app under Integrations → API keys. Keys start with hy_live_ and are shown once, when you create them, so store yours somewhere safe. Use keys only on your server, never in a browser or mobile app, and remove any key you think has leaked; it stops working at once.

Send a message

POSThttps://heyita.com/api/v1/messages

Text works while the customer's 24-hour window is open, that is, within 24 hours of their last message to you:

Request body: text
{
  "to": "919876543210",
  "type": "text",
  "text": "Hello"
}

Templates work at any time. Use the template's name and language as they appear on your Templates page. params fill the body variables in order ({{1}}, {{2}}, …). headerMediaUrl is needed only when the template has an image, video or document header, and must be a public HTTPS link.

Request body: template
{
  "to": "919876543210",
  "type": "template",
  "template": {
    "name": "order_update",
    "language": "en",
    "params": ["Asha", "#1234"],
    "headerMediaUrl": "https://example.com/order.jpg"
  }
}

A successful request returns the message:

Response
{
  "id": "<message id>",
  "waId": "wamid.HBgM...",
  "status": "sent"
}

id is Heyita's message ID and waId is WhatsApp's. Delivery and read updates follow as message.status webhooks.

curl -X POST https://heyita.com/api/v1/messages \
  -H "Authorization: Bearer $HEYITA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "919876543210",
    "type": "template",
    "template": { "name": "order_update", "language": "en", "params": ["Asha", "#1234"] }
  }'

Add or update a contact

POSThttps://heyita.com/api/v1/contacts

Creates a contact, or updates it if the phone number already exists. Only phone is required. attributes are saved as the contact's custom fields.

Request body
{
  "phone": "919876543210",
  "name": "Asha",
  "email": "asha@example.com",
  "tags": ["lead"],
  "attributes": { "city": "Pune" }
}
Response
{ "id": "919876543210", "created": true }

created is false when the contact already existed and was updated.

List templates

GEThttps://heyita.com/api/v1/templates

Returns every template on your account with its status. variables is the number of body variables, which is how many params to send.

Response
{
  "templates": [
    {
      "name": "order_update",
      "language": "en",
      "category": "UTILITY",
      "status": "APPROVED",
      "body": "Hi {{1}}, your order {{2}} is on its way.",
      "variables": 2
    }
  ]
}

Errors

When a request can't be completed, the API returns one of these status codes with a JSON body: error is a sentence you can show or log, and code, when present, is a short machine-readable reason such as plan_inactive or opted_out.

StatusMeaningWhat to do
400The request body isn't validCheck the fields and their formats
401The API key is missing, wrong or removedSend a current key in the Authorization header
402The workspace's plan isn't activeRenew the plan in Settings
409The 24-hour window is closedSend a template instead of text
422The contact has opted outDon't message them until they opt back in
404The contact or template wasn't foundCheck the phone number or the template name and language
502WhatsApp refused the messageRead error in the body: Meta's reason, for example an unpaid Meta account

Webhooks

Webhooks tell your server when something happens in Heyita. Add an endpoint in the app under Integrations → Webhooks, choose the events you want, and copy the endpoint's secret.

EventSent when
message.receivedA customer sends you a message
message.statusA message you sent is delivered, read or fails
contact.createdA new contact is added to the workspace
broadcast.finishedA broadcast has finished sending

Each event is a POST with a JSON body and two headers:

Webhook request
POST https://your-server.example.com/heyita
Content-Type: application/json
X-Heyita-Event: message.received
X-Heyita-Signature: sha256=5d2c0f...

{
  "event": "message.received",
  "workspaceId": "…",
  "at": 1733300000000,
  "data": { … }
}

at is the time of the event in milliseconds since 1970 (UTC). data holds the message, status, contact or broadcast. Reply with any 2xx status quickly and do slow work afterwards.

Each event is sent once and isn't retried. The app shows the last response status for each endpoint, so you can spot problems. To catch up after downtime, read the inbox or call the API.

Checking signatures

X-Heyita-Signature is sha256= followed by the hex HMAC-SHA256 of the raw request body, made with your endpoint's secret. Compute the same on your side from the raw bytes, before parsing the JSON, and compare the two in constant time. Reject the request if they differ.

import crypto from "node:crypto";
import express from "express";

const app = express();

// Read the raw body: the signature is over the exact bytes Heyita sent.
app.post("/heyita", express.raw({ type: "application/json" }), (req, res) => {
  const expected = "sha256=" + crypto.createHmac("sha256", process.env.HEYITA_WEBHOOK_SECRET).update(req.body).digest("hex");
  const given = req.get("X-Heyita-Signature") || "";
  const ok = given.length === expected.length && crypto.timingSafeEqual(Buffer.from(given), Buffer.from(expected));
  if (!ok) return res.sendStatus(401);

  const event = JSON.parse(req.body.toString("utf8"));
  console.log(event.event, event.data);
  res.sendStatus(200);
});
Need something the API doesn't do yet?

Tell us what you're building from the contact page. The API feature page explains what the API is for in plain words.

Build on WhatsApp without the paperwork

Create an account, connect your number with Meta's sign-up, and make your first API key in Integrations.