Service Notifications API
The Service Notifications API lets your systems send a transactional message, such as an OTP, an order update or a payment confirmation, the moment the event happens. One endpoint handles Email, SMS, WhatsApp and RCS. FirstHive routes each message through the provider configured for that notification, fills in the template, shortens and tracks links, and logs every call.
This article is for developers. To set up the notification itself, see Service Notifications.
Before you start
- Get API credentials. Your FirstHive team issues an API key and a secret key for your account. They’re for server-to-server integrations only.
- Create the service notification in Communication > Service Notification: add the channel, choose the sender, and create the template with its placeholders.
- Activate it. Change its status from Draft to Active. Requests to a Draft notification are rejected.
- Get the endpoint and Service ID. On the notification’s ⋮ menu, choose View Endpoint. It shows the Endpoint URL, the Service ID and a link to the full API docs. Each notification has its own Service ID.
Authentication
Send both headers on every request:
X-FH-Key-ID: <your_api_key>X-FH-Key-Secret: <your_secret_key>Content-Type: application/jsonRequests with missing or wrong credentials get 401 Unauthorized. Keep the secret key on your servers; never put it in a website, app or public code repository.
Send a notification
POST to the Endpoint URL shown in View Endpoint (path /api/v1/notify/send).
{ "serviceId": 1001, "channelType": "WHATSAPP", "recipient": "+919876543210", "attributes": ["John", "5829"], "buttonParams": ["https://example.com/verify?token=abc123"]}| Field | Type | Required | Description |
|---|---|---|---|
serviceId | number | Yes | The Service ID from View Endpoint. |
channelType | string | Yes | EMAIL, SMS, WHATSAPP or RCS. |
recipient | string | Yes | An email address for EMAIL; a phone number with country code, such as +919876543210, for the others. |
attributes | list of strings | No | Values for the template’s placeholders {{1}}, {{2}} and so on, in order. |
buttonParams | list of strings | No | Full URLs for the template’s dynamic URL buttons, in button order. WhatsApp and RCS only. |
Success response
{ "success": true, "data": { "success": true, "messageId": "msg_abc123def456", "message": "Notification sent successfully" }, "timestamp": 1711234567890}Error response
{ "success": false, "data": { "success": false, "message": "Failed to send notification", "errorCode": "CHANNEL_NOT_CONFIGURED" }, "timestamp": 1711234567890}A 200 status means the request was processed. Always check the success field in the body.
Placeholders
Values in attributes replace the template’s numbered placeholders by position: the first value fills {{1}}, the second fills {{2}}, and so on.
| Template | attributes | Message sent |
|---|---|---|
Dear {{1}}, your OTP is {{2}}. Valid for {{3}} min. | ["John", "5829", "5"] | Dear John, your OTP is 5829. Valid for 5 min. |
Hi {{1}}, your order {{2}} has been shipped. | ["John", "ORD-001"] | Hi John, your order ORD-001 has been shipped. |
There’s no endpoint to look up a template’s placeholders, so record the order and meaning of each placeholder when you create the template, and share it with your developers. For WhatsApp, the number and order of values must match the approved template exactly.
Examples by channel
SMS
{ "serviceId": 1001, "channelType": "SMS", "recipient": "+919876543210", "attributes": ["John", "5829"] }{ "serviceId": 1002, "channelType": "EMAIL", "recipient": "user@example.com", "attributes": ["John Doe", "ORD-2026-001"] }WhatsApp with a dynamic URL button
{ "serviceId": 1003, "channelType": "WHATSAPP", "recipient": "+919876543210", "attributes": ["John", "482910"], "buttonParams": ["https://example.com/verify?token=abc123"] }RCS with a dynamic URL button
{ "serviceId": 1004, "channelType": "RCS", "recipient": "+919876543210", "attributes": ["John", "ORD-2026-001"], "buttonParams": ["https://example.com/track?id=ORD-2026-001"] }Link shortening and click tracking
For WhatsApp and RCS, FirstHive shortens links automatically and tracks clicks. Always send the original, full URL.
- A URL in
attributes(any value starting withhttp://orhttps://) is replaced in the message with a tracked short link. - A URL in
buttonParamsis shortened, and the button receives the short code. - When the customer clicks, the click is recorded and they’re redirected to the original URL.
- Values that aren’t URLs, such as names or OTPs, are sent unchanged.
Links in SMS and Email service notifications are sent as you pass them, without shortening. See Short URLs and Vanity URLs.
Errors
| Status | Meaning |
|---|---|
200 | Request processed; check success in the body. |
400 | Bad request: a required field is missing, or the input failed validation. |
401 | Missing or invalid API key or secret. |
404 | The Service ID doesn’t exist. |
409 | Conflict: duplicate resource. |
500 | Server error. |
| Problem | Likely cause | What to do |
|---|---|---|
| Authentication required | Key or secret missing or wrong. | Send both headers on every request, with the values issued to you. |
| Service not found | Wrong serviceId. | Copy the Service ID from View Endpoint. |
| Channel not configured | The channel isn’t set up for this notification. | Add and configure the channel in the notification. |
| Template not found | No template for the channel. | Create the template in the notification. |
| Validation error | A required field is missing, or the input contains script or query code. | Check and correct the request. |
| Service temporarily unavailable | The messaging provider is failing and FirstHive has paused sending to protect it. | Retry after 30 seconds, with exponential backoff. |
Temporary pauses
If the messaging provider starts failing (half of the last 10 calls), FirstHive pauses sending through it for 30 seconds and returns an error, then tries a few test calls before resuming. Build retries into your integration: wait 30 seconds, then increase the delay on each retry.
Security and logging
- All input is checked, and requests containing scripts or database query operators are rejected.
- Recipients are masked in logs, for example
+91****3210andj***@example.com. - Every call is logged with the caller, request, response status, client IP and duration.
Checklist
- Get your API key and secret key from your FirstHive team.
- Create the service notification, add the channel and sender, and create the template with its placeholders.
- Change the status from Draft to Active.
- Copy the Endpoint URL and Service ID from View Endpoint.
- Send a test request to your own phone or email, then go live.
Related articles
© 2026 FirstHive. All rights reserved.