Twilio Integration
Overview
Integrate Twilio with Genfin to automatically send call recordings for analysis. This guide provides step-by-step instructions to set up the integration using Twilio's Recording Status Callback.
Step 1: Configure Twilio to Record Calls
To record calls in Twilio, you can use the <Record>
verb in your TwiML or set the record
parameter to true
when initiating a call via the REST API (Twilio)
Using TwiML:
<Response> <Record recordingStatusCallback="https://api.genfin.ai/webhooks/twilio?company=your_company_name" recordingStatusCallbackMethod="POST" recordingStatusCallbackEvent="completed" /> </Response>
Using REST API:
from twilio.rest import Client client = Client(account_sid, auth_token) call = client.calls.create( to='+1234567890', from_='+0987654321', url='http://example.com/twiml', record=True, recordingStatusCallback='https://api.genfin.ai/webhooks/twilio?company=your_company_name', recordingStatusCallbackMethod='POST', recordingStatusCallbackEvent=['completed'] )
Using Twilio Studio:
You can also use Twilio Studio to use the Recording Status Callback URL for only a white-listed subset of inbound phone numbers.
Replace your_company_name
with your organization's identifier used in Genfin.
The correct approach will depend on your specific Twilio infrastructure. You can configure Twilio to send Genfin every inbound and outbound recorded call or only a subset of calls, depending on your needs.
Step 2: Handle the Recording Status Callback
Twilio will send a POST
request to the specified recordingStatusCallback
URL when the recording is completed. Ensure your server is set up to handle this request appropriately.
Step 3: Genfin's Expected Response
Upon receiving the callback, Genfin will process the recording and respond with:
{ "status": "success", "message": "Recording processed successfully" }
If the company
parameter does not match any organization in Genfin, the response will be:
{ "status": "success", "message": "Invalid company" }
Need Assistance?
If you're unsure about your Genfin company identifier or need help configuring Twilio's webhook, please contact Genfin Support at support@genfin.ai.