Twilio Integration

Connect Twilio Programmable Voice to import recorded calls into Genfin with the agent's name, audio, and transcript.

Before you start

You need permission to manage Genfin integrations and the Account SID and primary Auth Token for the Twilio account or subaccount that owns the recordings. Your developer will need to update your application's recording settings.

1. Connect Twilio

  1. In Genfin, open Organization → Integrations → Twilio → Connect.
  2. Enter your Account SID and Auth Token, then select Save and continue.
  3. Copy the callback URL. You can find it again under Setup instructions.

2. Configure your recordings

In your Programmable Voice application:

  1. Enable recording for the calls you want to import.
  2. For each recording, add the assigned agent's name to the copied callback URL. For Alex Smith, append &agent_name=Alex%20Smith. Keep integration_id and URL-encode the name. Include an agent name for every recording; Twilio does not supply it automatically.
  3. Use the resulting URL as the Recording Status Callback URL, with method POST and event completed.

Use a consistent, distinct name for each agent in your organization. Genfin matches agents by name, ignoring capitalization and surrounding spaces. For a conference, choose one agent to own the recording.

Python example

Set the environment variables for your Twilio account, destination, TwiML URL, Genfin callback URL, and assigned agent. In your application, use the agent handling each call.

import os
from urllib.parse import parse_qsl, urlencode, urlsplit, urlunsplit
from twilio.rest import Client

callback = urlsplit(os.environ["GENFIN_CALLBACK_URL"])
params = dict(parse_qsl(callback.query))
params["agent_name"] = os.environ["AGENT_NAME"]
callback_url = urlunsplit(callback._replace(query=urlencode(params)))

client = Client(
    os.environ["TWILIO_ACCOUNT_SID"],
    os.environ["TWILIO_AUTH_TOKEN"],
)
client.calls.create(
    to=os.environ["DESTINATION_PHONE_NUMBER"],
    from_=os.environ["TWILIO_PHONE_NUMBER"],
    url=os.environ["TWIML_URL"],
    record=True,
    recording_status_callback=callback_url,
    recording_status_callback_method="POST",
    recording_status_callback_event=["completed"],
)

Using TwiML or Studio? Use the same per-recording URL, including the agent's name, in your TwiML recording settings or Studio Call Recording widget. Set the callback method to POST and event to completed. Use the recording status callback so Twilio sends the notification when the audio is ready.

3. Test the connection

  1. Make and finish a recorded call through your configured flow.
  2. Open Calls in Genfin. Once processing finishes, confirm the audio plays, the transcript is available, and the correct agent appears.

Troubleshooting

  • No recording: check that recording is enabled and Twilio sent a completed recording callback. Check Twilio's logs for delivery errors.
  • Callback rejected: confirm the URL, POST method, and credentials. Send Twilio's signed callback directly to Genfin without rewriting the URL.
  • Missing or incorrect agent: check agent_name in the callback URL. Correct existing recordings in Genfin; resending a callback does not change their agent.
  • Processing does not finish: confirm the recording still exists in Twilio and your saved credentials are current, then contact Support.

Supported recordings

New Programmable Voice call and conference recordings in Twilio's US1 region are supported. Historical imports, encrypted or externally stored recordings, and other regions are not supported.

Disconnect or change credentials

Select Disconnect to stop future imports. Existing recordings remain in Genfin. To change credentials, let pending downloads finish, disconnect and reconnect, then update your application's callback URL.

Need help? Email support@genfin.ai with your organization name and the affected Call SID, Conference SID, or Recording SID. Do not include your Auth Token.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.