I want to create a new outbound call to a phone number via the API that should be handled by a TwiML App.
To do this, I provide the ApplicationSid
parameter instead of the Url
parameter as documented here
But I cannot find a way to pass any custom parameters as the only way to add custom parameters when creating a call to a phone number is to add them as query parameters to the URL as described here.
I could query the TwiML App from the API, read the configured Webhook URLs, add my custom Parameters as Query and pass them to Url
, StatusCallback
and FallbackUrl
when creating the Call but that seems redundant and overcomplicated.
Another solution would be to store the custom parameters in a local database with the CallSid as key, but I would like to avoid having local state.
Is there no way to simply tell the API to add some parameters to the Url when calling the webhooks of the TwiML App (as mentioned here)?
Twilio developer evangelist here.
I'm afraid there is no good way to pass parameters when calling using a TwiML app. Your options are, as you described, send URLs with the query parameters in the API request instead of sending a TwiML App SID or store the parameters locally against the CallSid as a sort of session store.