Introduction
The TrustForce Hosting API lets your app send and receive WhatsApp messages, manage automated keyword replies, and pull message history — all through one REST API backed by your linked WhatsApp number(s).
Base URL for every endpoint below:
Authentication
Every request needs your API key (from Dashboard → API keys) in the Authorization header:
Most endpoints also accept an optional session parameter — the session key shown on your WhatsApp number's card in the dashboard. If you leave it out, the key's default number is used.
Errors
Errors come back as JSON with an error field and a standard HTTP status code:
| Code | Meaning |
|---|---|
| 401 | Missing, invalid, or revoked API key |
| 403 | Key doesn't have the required permission, or account suspended |
| 404 | Endpoint or resource not found |
| 409 | WhatsApp number not connected yet |
| 422 | Missing or invalid parameter |
| 429 | Plan limit reached (messages, webhooks, or rules) |
| 502 | The open-wa server returned an error |
Send a message
Requires the send scope. Sends a text message, or an image/document by URL.
| Param | Description |
|---|---|
| to | Destination number, digits with country code (e.g. 27825550142) |
| message | Text body (required unless sending media) |
| media_url | Public URL of an image/document to send instead of text |
| media_type | image | document | video (default image) |
| caption | Optional caption for media |
| session | Optional session key, if not using the key's default |
Session status
Requires the read scope. Returns connection state for one number.
List your numbers
Requires the read scope. Returns every WhatsApp number on your account.
Webhooks
Requires the webhook scope. List or create webhooks. Creating one returns a forward_secret used to sign forwarded events (see below).
| Param (POST) | Description |
|---|---|
| session | Session key this webhook listens on |
| name | A label for the webhook |
| forward_url | Optional — your server's URL to receive raw events |
Keyword rules
Requires the webhook scope. Manage the keyword → auto-reply rules attached to a webhook.
| Param | Description |
|---|---|
| webhook_id | Required on every call |
| keyword | The text or regex pattern to match (POST) |
| match_type | contains | exact | starts_with | regex |
| case_sensitive | true/false, default false |
| reply_type | text | image | document | no_reply |
| reply_text | Reply body or caption |
| reply_media_url | URL for image/document replies |
| priority | Lower number is checked first |
| id | Rule id (DELETE only) |
Message logs
Requires the read scope. Returns your most recent inbound and outbound messages, newest first.
Receiving messages: forwarded events
If you set a forward_url on a webhook, every inbound message on that number is POSTed to your server as it arrives — whether or not it matched a keyword rule:
matched_rule is the id of the keyword rule that fired, or null if nothing matched.
Verifying signatures
Every forwarded request includes an X-TFH-Signature header: an HMAC-SHA256 of the raw request body, signed with the webhook's forward_secret. Verify it before trusting the payload: