GHL: Migrate to V2
This guide walks you through the process of upgrading to V2 Assistant using the SynthFlow API. The setup consists of three primary steps:
- Creating a custom phone number
- Updating the assistant and linking it to the phone number
- Dialing to the SIP Endpoint
API Base URL: <https://api.synthflow.ai>
Step 1: Create a Custom Phone Number
Follow the structure to create a custom phone number, phone_number
can be your internal id or a random string.
Endpoint:
POST /v2/custom-numbers
Headers:
Request Body:
trunk_username
andtrunk_pwd
are optional and can be omitted unless required for your configuration.
Step 2: Update to V2 Assistant
This step registers a V2 Assistant and links it to the custom phone number created in Step 1. Ensure the phone number is successfully created before proceeding.
Endpoint:
PUT /v2/assistants/{model_id}
Headers:
Request Body:
For additional fields and configurations, refer to the official API documentation.
Final Step: Initializing the call
Creating the call
Endpoint:
POST /v2/prepare_inbound
Headers:
Request Body
Response Format
synthflow_call_id This is the call ID that should be sent to the SIP trunk via the X-EI header.
call_status Indicates the status of the call. A value of registered means that SynthFlow is operational, while failed indicates a service outage.
Forward call to SIP Trunk
After the call is created on SynthFlow, redirect Twilio calls to it using TwiML commands. Make sure to include the received synthflow_call_id
in the SIP headers using the X-EI
key, formatted as follows:
X-EI=S.synthflow_call_id
;
Regex pattern: (S|E)\.([^\;]+);
Here’s a code snippet for redirecting a call:
The transfer call will work the same as before.