Heroshhi API
Read and write leads, WhatsApp messages, appointments and deals from your own systems, and hear about events the moment they happen. The same API powers the Heroshhi Zapier app and works with Make.
https://api.heroshhi.com/api/v1API keys
Create a key in Heroshhi under Settings → Integrations → API keys. It is shown once, so copy it somewhere safe. Send it with every request:
Every request: Authorization: Bearer hs_live_…
A key acts as the person who made it: it sees the same leads and has the same permissions. Removing the key stops it at once, and removes the webhooks it created.
// Check a key works
GET https://api.heroshhi.com/api/v1/me
Authorization: Bearer hs_live_…
Limits
Each key can make 120 requests a minute. Sending WhatsApp messages is limited to 300 a key an hour. Go over a limit, and you get 429 Too Many Requests: wait a moment and try again.
Lists come in pages of up to 100. Each reply carries a next_cursor; pass it as cursor to get the next page.
Leads
| Method | Endpoint | What it does |
|---|---|---|
| GET | /leads | List leads. Filters: status, stage, source, tag, search, phone, created_since, updated_since, plus limit and cursor |
| GET | /leads/{id} | One lead, with its custom fields |
| POST | /leads | Add a lead. name and phone required; email, source, inquiry, utm_* optional. A phone already in your account returns that lead with created: false |
| PATCH | /leads/{id} | Change status, add or remove tags (tags_add, tags_remove), set next_follow_up_at |
| POST | /leads/{id}/notes | Add a note: { "text": "…" } |
| GET | /lead-fields | Your own lead fields and stage names |
POST /api/v1/leads
{
"name": "Aditi Sharma",
"phone": "919876543210",
"source": "Website form",
"inquiry": "Hair PRP, weekend slot"
}
WhatsApp messages
| Method | Endpoint | What it does |
|---|---|---|
| GET | /leads/{id}/messages | The conversation, newest first |
| POST | /leads/{id}/messages | Send a message. { "text" } within 24 hours of their last message; otherwise { "template", "params": [] } |
| GET | /templates | Your approved templates, and how many blanks each one has |
WhatsApp allows free text only within 24 hours of the customer's last message. Outside that window you get 409 outside_24h_window: send a template instead. Anyone who has opted out is refused with 403 opted_out.
Appointments
| Method | Endpoint | What it does |
|---|---|---|
| GET | /appointments | Appointments between from and to (up to 92 days), by status |
| GET | /leads/{id}/appointments | One lead's appointments |
| POST | /leads/{id}/appointments | Book one: date (YYYY-MM-DD) required; time (HH:MM, India time), type, staff, notes |
| PATCH | /leads/{id}/appointments/{appointmentId} | Change status (scheduled, confirmed, completed, cancelled, no_show), date, time, notes |
Deals
| Method | Endpoint | What it does |
|---|---|---|
| GET | /deals | Deals by pipeline_id, status (open, won, lost) or lead_id, with the open value and forecast |
| POST | /deals | Create one: lead_id required; title, value (₹), pipeline_id, stage, expected_close_date |
| PATCH | /deals/{id} | Move it on: stage, value, title, expected_close_date, lost_reason |
| GET | /pipelines | Your pipelines and their stages |
Webhooks
Heroshhi tells your system the moment something happens. Add the address under Settings → Integrations → Webhooks and pick the events, or subscribe from code.
| Event | Sent when |
|---|---|
lead.created | A new lead arrives |
lead.status_changed | A lead's status changes |
lead.converted | A lead is marked converted |
lead.assigned | A lead is given to someone |
appointment.created | An appointment is booked |
message.received | A customer sends a WhatsApp message |
deal.created | A deal is created |
deal.stage_changed | A deal moves to another stage |
deal.won | A deal is won |
deal.lost | A deal is lost |
quote.paid | A quote is paid |
| Method | Endpoint | What it does |
|---|---|---|
| POST | /hooks | Subscribe: { "target_url", "event" } |
| DEL | /hooks/{id} | Unsubscribe |
| GET | /events | The events on offer |
| GET | /hooks/sample/{event} | Recent examples, shaped like real deliveries |
What arrives
POST https://your-system.example.com/heroshhi
X-Heroshhi-Signature: sha256=…
{ "id": "…", "event": "lead.created", "createdAt": "2026-11-17T08:30:00Z", "account": "…", "data": { … } }
When you save a secret with the webhook, each delivery is signed: X-Heroshhi-Signature is the HMAC-SHA256 of the raw body with that secret. Check it before trusting the delivery. Reply with any 2xx within 10 seconds; failed deliveries are retried after 1, 5, 30, 120 and 720 minutes. For subscriptions made through the API (as Zapier does), answering 410 Gone removes the subscription.
// Node.js: check the signature
const expected = 'sha256=' + crypto.createHmac('sha256', SECRET).update(rawBody).digest('hex');
const ok = crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(req.get('X-Heroshhi-Signature') || ''));
Zapier and Make
Zapier: the Heroshhi app has instant triggers (new lead, status changed, converted, assigned, new appointment, new WhatsApp message, deal won, deal stage changed, quote paid), actions (create or update a lead, add a note, send a WhatsApp message, book an appointment, create or update a deal) and a lead search. Ask us at support@heroshhi.com for the invite link, then sign in with an API key.
Make: no app needed. For events, add Webhooks → Custom webhook in Make and paste its address into Heroshhi's webhooks. To add or change leads, use HTTP → Make a request with https://api.heroshhi.com/api/v1/leads and the header Authorization: Bearer hs_live_….
Lead webhook (no key needed)
The quickest way to send leads from a website form or form builder. Copy your account's address from Settings → Lead sources; the key at its end identifies your account, so keep it private.
POST https://api.heroshhi.com/api/webhook/lead/{your-webhook-key}
{
"name": "John Doe",
"phone": "919876543210",
"email": "john.doe@example.com",
"source": "Website form",
"inquiry": "Product enquiry"
}Open the same address with /test on the end in a browser to check it.
LeadSquared
Clients on LeadSquared keep working there. Under Settings → LeadSquared, Heroshhi shows exactly what to paste into LeadSquared's WhatsApp Cloud API provider screen, so LeadSquared sends WhatsApp through your Heroshhi number and customers' replies flow back. Add your LeadSquared API keys on the same screen, and new Heroshhi leads are added to LeadSquared within a few minutes, matched by phone.
Meta Conversions API
Meta knows a person clicked your ad. It doesn't know whether they became a customer. Heroshhi sends that back, so Meta can aim your ads at people who actually convert, not just people who fill in forms.
Three kinds of lead, three ways of sending
Meta identifies each source differently. With the wrong identifier, an event is accepted but never matched to an ad, so Heroshhi detects the source and sends it the right way.
| Lead came from | Identifier | action_source | Sent to |
|---|---|---|---|
| Website form | fbclid | website | Pixel |
| Click-to-WhatsApp ad | ctwa_clid | business_messaging | Pixel |
| Meta Instant Form | lead_id | system_generated | CRM dataset |
Click-to-WhatsApp identifiers come in the referral object of the customer's first message, and are picked up automatically. Instant Form leads carry a 15 to 17 digit lead ID in the id column of Meta's export.
Events Heroshhi sends
| Event | Sent when |
|---|---|
Lead | A new lead arrives, from any source |
Qualified | The lead shows real interest: a call logged as interested, or an appointment booked (a callback alone isn't enough) |
Converted | The lead becomes a customer, with the value when a payment is recorded |
Not Qualified | Never a real prospect: wrong number, spam, or a clear no before any interest |
Lost | A real prospect who didn't buy, for example on price or because they booked elsewhere |
Each event's name can be changed in your settings, to match the stages you set up in Meta's lead funnel.
Settings
PUT /api/users/conversion-api
{
"facebook": {
"enabled": true,
"pixelId": "123456789012345",
"accessToken": "EAAxxxxx...",
"crmDatasetId": "987654321098765",
"testEventCode": "TEST12345"
},
"events": {
"sendLeadEvent": true,
"sendQualifiedEvent": true,
"sendConversionEvent": true,
"sendDroppedEvent": true // covers both Not Qualified and Lost
}
}
crmDatasetId is only needed for Meta Instant Forms. Meta keeps website events and CRM events in separate datasets, so lead stages need their own: create one in Events Manager under Connect data sources, then CRM. Leave it empty, and everything goes to the Pixel.
Worth knowing before you switch it on
- Matching starts the day you switch it on. Older leads carry no click ID and can't be matched afterwards.
- Meta needs a few hundred results before delivery changes. Expect three to four weeks, not three days.
- Nothing useful reaches Meta unless your team records outcomes. If every lead stays New, Meta learns nothing.
- Personal details are hashed with SHA-256 before sending. Meta can match them but can't read them.
- Remove the test event code once delivery is confirmed, or real events keep landing in the test view.
Checking delivery
Copy the test event code from Events Manager into your settings, change a lead's stage, and watch the Test events tab. The event should appear within a minute or two. Instant Form events appear under the CRM dataset, not the Pixel.
Errors
Errors always come back in the same shape:
{ "error": { "code": "outside_24h_window", "message": "…" } }
| Code | Meaning |
|---|---|
200 / 201 | It worked / created |
400 | Something in the request is wrong |
401 | The key is missing or no longer valid |
403 | Not allowed for this key, or the contact opted out |
404 | That record doesn't exist, or isn't in your account |
409 | Outside WhatsApp's 24-hour window |
429 | Too many requests: wait and try again |
Security
Keys are stored only as one-way fingerprints and shown once. Every request is limited to the key owner's own account and permissions. Webhook deliveries are signed and go only to public internet addresses. More on our Security page.
