You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seem silly but there is constructors and functions to generate Twiml but no way to create these objects from a given TwiMl string. The use case is using a Twilio function to call multiple webhooks (since UI only allows to call one webhook) but webhook responds with a Twiml string as Twilio expects but the function must call the Twilio context function with a twiml.MessagingResponse object and there seems to be no easy way to go from a Twiml string to a MessagingResponse object short of parsing the text out of the TwiML and recreating the message from plain text.
Either the Twilio function context should allow for a Twiml string and not only specifically expect MessagingResponse object or MessagingResponse should be easily created from a Twiml string.
I don't want to modify my webhook to return differently because the same webhook is being used by another number which only needs to call just this webhook so no need for a function and when Twilio calls the webhook, it expects Twiml
My workaround for now is to use regex to strip out the xml tags and recreate the message using the constructors with the plain string but seems crappy
Steps to Reproduce
Go to a phone number settings
Setup to call multiple webhooks, you can't. So have to use a function.
In function definition, you call all webhooks and call the context function with one of the responses, coming as Twiml string.
Doesn't work. It expects MessagingResponse. No easy way to create that for a given Twiml either.
Code Snippet
# pastecodehere
Exception/Log
# paste exception/log here
Technical details:
twilio-node version:
node version:
The text was updated successfully, but these errors were encountered:
Issue Summary
It seem silly but there is constructors and functions to generate Twiml but no way to create these objects from a given TwiMl string. The use case is using a Twilio function to call multiple webhooks (since UI only allows to call one webhook) but webhook responds with a Twiml string as Twilio expects but the function must call the Twilio context function with a twiml.MessagingResponse object and there seems to be no easy way to go from a Twiml string to a MessagingResponse object short of parsing the text out of the TwiML and recreating the message from plain text.
Either the Twilio function context should allow for a Twiml string and not only specifically expect MessagingResponse object or MessagingResponse should be easily created from a Twiml string.
I don't want to modify my webhook to return differently because the same webhook is being used by another number which only needs to call just this webhook so no need for a function and when Twilio calls the webhook, it expects Twiml
My workaround for now is to use regex to strip out the xml tags and recreate the message using the constructors with the plain string but seems crappy
Steps to Reproduce
Code Snippet
Exception/Log
Technical details:
The text was updated successfully, but these errors were encountered: