Get Integration Status
Retrieves a comprehensive overview of the agency's integration configuration, including Ultravox and Telnyx API key status, telephony provisioning state, webhook URL, and actionable next steps. This endpoint powers the settings/integration status page in the frontend.
Endpoint
| Property | Value |
|---|---|
| Function Name | get-integration-status |
| HTTP Method | GET |
| Authentication | Supabase JWT (Bearer token in Authorization header) |
| Required Role | Any authenticated agency user |
Request
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <supabase_jwt> |
Query Parameters
None.
Response
Success (200)
{
"agency_id": "uuid",
"agency_name": "Acme Corp",
"webhook_url": "https://your-project.supabase.co/functions/v1/webhook-ingest/{agency_id}/{webhook_secret}",
"ultravox": {
"configured": true,
"added_at": "2025-01-15T10:00:00Z",
"validated_at": "2025-01-15T10:01:00Z"
},
"telnyx": {
"configured": true,
"has_public_key": true,
"added_at": "2025-01-16T12:00:00Z",
"validated_at": "2025-01-16T12:01:00Z",
"application_id": "telnyx-app-id",
"outbound_profile_id": "telnyx-profile-id",
"provisioned": true
},
"ready_for_provisioning": true,
"telephony_configured": true,
"next_steps": [
"Ready! You can now create agents and purchase phone numbers"
],
"can_manage_agents": true,
"can_manage_phone_numbers": true,
"can_run_campaigns": true
}
Error Responses
| Status | Condition |
|---|---|
| 401 | Missing or invalid Authorization header / JWT token |
| 403 | Authenticated user is not associated with an agency |
| 404 | Agency record not found in database |
| 405 | HTTP method is not GET |
| 500 | Unexpected server error |
Behavior
- Handles CORS preflight (
OPTIONS) requests and rejects non-GETmethods with a405. - Validates the JWT token via
supabase.auth.getUser(). - Looks up the user's
agency_idandrolefrom theuserstable. - Fetches the full agency record from the
agenciestable, including:- Encrypted API key presence indicators (not the keys themselves)
- Timestamps for when keys were added and validated
- Telnyx provisioning IDs (
application_id,outbound_profile_id) - Overall
telephony_configuredflag
- Constructs the agency's webhook URL from the Supabase URL, agency ID, and webhook secret.
- Computes derived status fields:
ultravox.configured: Whether an encrypted Ultravox API key exists.telnyx.configured: Whether an encrypted Telnyx API key exists.telnyx.has_public_key: Whether a Telnyx public key is stored (needed for webhook verification).telnyx.provisioned: Whether bothapplication_idandoutbound_profile_idare set.ready_for_provisioning: Ultravox configured AND Telnyx configured AND Telnyx public key present.telephony_configured: Mirrors thetelephony_configuredcolumn from the agency record.
- Generates a prioritized
next_stepslist guiding the user through the setup process. - Sets capability flags (
can_manage_agents,can_manage_phone_numbers,can_run_campaigns) based on configuration completeness.
Database Tables
| Table | Operation | Description |
|---|---|---|
users | Read | Fetches agency_id and role for the authenticated user |
agencies | Read | Fetches full integration configuration for the agency |
External APIs
None.
Related Functions
get-sync-status-- Retrieves historical sync job progressget-ultravox-agents-- Lists Ultravox agents with local mapping datasave-agent-mapping-- Saves agent-to-campaign mappings (requirescan_manage_agents)webhook-ingest-- The webhook URL returned by this function points to this endpoint