Connecting Your Account
Connecting your Twilio account to Loquent stores your credentials securely in Loquent’s database and enables BYO mode for your organization. No changes are made to your Twilio account during this step.
Prerequisites
Section titled “Prerequisites”- A Twilio account with at least one active phone number (or the ability to buy one)
- Your Account SID — starts with
AC, found on the Twilio Console homepage - Your Auth Token — found on the same page (click to reveal)
- Go to Settings in the Loquent dashboard
- Find the Twilio section (requires
Twilio:Collection:Createpermission or org owner) - Enter your Account SID and Auth Token
- Click Connect
Loquent validates your credentials against the Twilio API before saving. If the credentials are invalid, you’ll see an error and nothing is written.
On success:
- The form shows your masked SID (e.g.
AC••••••••1234) organization.byo_twiliois set totrue- Your credentials are stored in
organization.twilio_account_sidandorganization.twilio_auth_token
What Happens Under the Hood
Section titled “What Happens Under the Hood”POST /api/twilio/connect → Calls GET https://api.twilio.com/2010-04-01/Accounts/{sid}.json with Basic auth (sid:token) → If 2xx: saves credentials to org record, sets byo_twilio = true → If error: returns validation failure, nothing writtenThe Auth Token is never returned in any API response and is never logged. The GET /api/settings endpoint only returns the masked SID.
Credential Resolution
Section titled “Credential Resolution”Once connected, all Twilio operations use your credentials:
Every Twilio API call: 1. Load org record 2. org.twilio_account_sid present? → use BYO credentials 3. org.byo_twilio = true but no SID? → error (no shared fallback) 4. org.byo_twilio = false → use shared Loquent accountPermissions Required
Section titled “Permissions Required”The connect endpoint requires the Twilio:Collection:Create permission. Org owners bypass this check.
API Reference
Section titled “API Reference”| Method | Path | Description |
|---|---|---|
POST | /api/twilio/connect | Validate and save BYO credentials |
GET | /api/settings | Returns byo_twilio flag and masked SID |
Module Structure
Section titled “Module Structure”src/mods/twilio/├── api/│ └── connect_twilio_api.rs # POST /api/twilio/connect└── utils/ └── validate_twilio_credentials_util.rs # Validates via Twilio API
src/mods/settings/├── api/│ └── get_settings_api.rs # Returns masked SID├── types/│ └── settings_data_type.rs # SettingsData struct└── components/ └── twilio_connect_section_component.rs # UI connect form