How does it work?
When a conversation reaches a Transfer Methods block configured with the API destination, Treble sends aPOST request to the endpoint you configured, with the contact’s and the conversation’s information. Your service decides which agent should attend to it and returns that agent in the response. Treble assigns the conversation to that agent.
If your service doesn’t respond in time, or the agent you return can’t receive the conversation, Treble applies your company’s fallback method so the conversation is never left unassigned.
This webhook is not configured in the webhook center, but inside the block itself in the conversation editor. That way, each block can call a different endpoint.
Configure the block
Learn how to configure the URL and the authentication from the conversation editor.
Authentication
In the block you can choose between two options:- No authentication — Treble calls your endpoint without credentials.
- Token / API Key — Treble sends the token you configured in the
Authorizationheader:
The request Treble sends
Treble makes aPOST with a JSON body containing the contact’s and the conversation’s context.
cellphone and country_code can arrive as null for contacts that only exist as a Meta username. In that case, use business_scope_id or username to identify the user.CRM identifiers
When your account has a CRM integration, the request includes the contact’s identifiers in your CRM so you can decide based on the record; for example, look up the record’s owner and return that agent.crm_type— the CRM your account is integrated with. It’snullif the account has no integration.crm_objects— the CRM records associated with the contact. Each one carries itsentity(the object type in the CRM, for exampleContact,Account, orLead) and itsid(the record’s identifier in your CRM). A contact associated with several Salesforce objects carries one entry per object; in other CRMs there’s a single entry. An empty array means the contact isn’t associated with any record yet.
The response you must return
Respond with200 and a JSON body that identifies the agent. You can do it by email (recommended) or by id:
agent_email— the agent’s email as registered in Treble. It’s the recommended option because it doesn’t depend on Treble’s internal identifiers.agent_id— the agent’s identifier in Treble.
email and id values you must return— use the get your company’s agents endpoint.
Implementation example
A minimal Node.js endpoint that returns an agent based on the contact:Next steps
Endpoint reference
Explore the full schema of the request and the response.
Get the agents
Look up the agents in your account to know which email or id to return.