Integration
Connect a tenant, link your business tools, and bring WhatsApp into your workflow.
Before you begin
Have these details ready before making your first request:
| Requirement | What you need |
|---|---|
| Active tenant | A numeric tenantId and tenant status ACTIVE. |
| Tenant bearer token | The token generated for that tenant in tenant management. |
| Backend origin | Your AV Bot API origin: https://avbot.server.avolvelabs.com. |
| WhatsApp connection | A tenant-owned business account, provider access token, and linked phone number. |
| Approved template | An active, approved template with its required inputs filled in. |
The documentation app is separate from the API server. Send API requests to https://avbot.server.avolvelabs.com.
Authenticate every public API request
Send the bearer token in the authorization header and the matching tenant ID in the JSON body. A numeric string is also accepted for the ID.
Authorization: Bearer YOUR_TENANT_TOKEN
Content-Type: application/jsoncurl --request POST 'https://avbot.server.avolvelabs.com/api/v1/templates' \
--header 'Authorization: Bearer YOUR_TENANT_TOKEN' \
--header 'Content-Type: application/json' \
--data '{"tenantId": 1}'The token establishes the tenant scope. Providing another tenant’s ID returns 403, even with a valid token. Suspended or disabled tenants cannot use these endpoints.
Connect your business tools
WhatsApp Business
In the tenant dashboard, add the WhatsApp Business account, configure its provider credentials, and link each sender phone number. Templates belong to a specific account. Use the returned account UUID and Meta phone number ID when an API request needs an explicit sender.
Salesforce
Connect Salesforce within the tenant and select the account to import from. Lead and Contact import jobs use the selected account’s saved credentials. Imported contacts remain tenant-scoped, and the marketing opt-in choice is configured when creating the import.
Salesforce credentials and tenant bearer tokens stay on the backend. The public template endpoints do not accept Salesforce credentials.
Understand template ownershipEmbed the chat inbox
For Salesforce or another host application, exchange a server-held tenant token for a short-lived chat session. Authenticate the host user and authorize tenant access before calling this endpoint.
/chat/sessionsPOST https://avbot.server.avolvelabs.com/chat/sessions
Authorization: Bearer YOUR_TENANT_TOKEN
Content-Type: application/json
{
"parentOrigin": "https://your-company.lightning.force.com"
}The response’s data.token is a chat-only credential valid for one hour. Load the inbox iframe with the tenant ID and exact parent origin:
<iframe
id="whatsapp-chat"
title="WhatsApp chat"
src="https://INBOX_HOST/embed/chat?tenantId=1&parentOrigin=https%3A%2F%2Fyour-company.lightning.force.com"
style="width:100%;height:720px;border:0"
referrerpolicy="no-referrer"
></iframe>When the frame sends avbot:chat:ready, validate its origin and source window. Fetch a fresh session through your host backend and send it to that frame with postMessage.
// After validating event.origin and event.source:
const frame = document.getElementById("whatsapp-chat");
frame.contentWindow.postMessage(
{
type: "avbot:chat:session",
tenantId: 1,
token: session.token,
},
"https://INBOX_HOST",
);The frame requests a refreshed credential every 50 minutes. Implement the session endpoint and message listener in the host application. In Salesforce, use Apex with a Named Credential and an LWC or Visualforce host; configure Trusted URLs for the inbox origin.
Check your integration
- The tenant is active and your token belongs to it.
- Listing templates succeeds from your integration backend.
- The chosen template is active, approved, and has a linked sender.
- All required template inputs are populated.
- Your caller handles 429 and Retry-After without retrying uncertain sends.
- You save messageId and follow delivery in the tenant’s message history.