Attaching user identity to inbound Telnyx → Vapi c...
# support
q
We’re trying to finish the migration of our inbound phone flow (Telnyx DID → Vapi assistant) so that each PSTN call is associated with the correct user inside our multi-tenant app What works so far Telnyx is hitting our Vapi assistant; the call connects and all speech-update / status-update webhooks reach our server endpoint (/api/vapi/server). What still doesn’t work Inbound Telnyx calls never arrive with call.metadata.userId. We’re patching the call with user metadata on the first webhook (lookup phone number → PATCH /call/{id} with metadata.userId/tenantId), but the tool payloads never pick it up. Vapi doesn’t appear to fire the legacy assistant-request event anymore, so we don’t have an earlier hook to attach identity before tools start running. The only events we see are speech-update, status-update, etc. What we’ve tried For each webhook, if call.customer.number matches a row in our user_phones table, we PATCH the call via Vapi’s API with:
Copy code
{
     "metadata": {
       "userId": "<stack-user-id>",
       "tenantId": "<uuid>",
       "phoneNumber": "+1415…",
       "source": "pstn"
     }
We see the PATCH succeeding (200 OK) on our side. Despite that, subsequent tool calls still arrive without call.metadata.userId, so our auth layer continues to fall back. Questions - Is PATCH /call/{id} the correct way to inject identity for PSTN calls, or should we be using a different endpoint (e.g., squadding a tool that runs before the first utterance)? - Is there a newer webhook/event we should subscribe to that replaces assistant-request for server-side metadata injection? - Are there known limitations when patching metadata mid-call that would prevent tool payloads from picking up the new fields? - If you have an example of the recommended flow for associating a Telnyx DID with a user account, we’d love to follow it: this feels like a common use case. Any pointers would be hugely appreciated.
c
Hi quanto, To connect Telnyx with Vapi for both inbound and outbound calls, follow these steps: 1. **Import Telnyx Numbers**: Ensure you have an active Telnyx account with phone numbers to import. Refer to the [Telnyx phone numbers import guide](https://docs.vapi.ai/telnyx). 2. **Configure Outbound Calling**: - Log into your Telnyx account. - Go to the [Telnyx Portal](https://portal.telnyx.com/#/outbound-profiles) and set up or select an outbound voice profile. - Under "Connections and Applications," add Vapi as a connection and save the configuration to enable outbound calling. 3. **Integrate Telnyx SIP Trunk with Vapi**: - Log into your Vapi account. - Navigate to Organization Settings to copy your Private Key. - Go to Voice / SIP Trunking / Create, and set the FQDN to
sip.vapi.ai
with port 5060. - Assign your Telnyx phone number to the SIP trunk and adjust voice settings as necessary ([integration guide](https://docs.vapi.ai/advanced/sip/telnyx)). - Create authentication credentials in Vapi for using Telnyx. - Use Vapi API for additional configuration ([API setup example](https://docs.vapi.ai/advanced/sip/sip-trunk)). Be sure to check your configuration and permissions on both platforms to facilitate a smooth integration.
2 Views