Modifying Xano API response Content-Type to "text/xml"
Hello - I have connected my Xano API to Twilio. When my Twilio number receives a text, the information is forwarded to my API via webhook. This is all working well.
Unfortunately, Twilio requires an empty Response element in text/xml format. Without this response, I am receiving errors.
Would someone please let me know the best way to modify the Xano API response Content-Type from json to xml?
For further context, the objective I'm trying to solve for is summed up well by lucky.expert's comment on Stack Overflow:
Thanks in advance for any help.
Answers
-
Under utility in the functions menu there is one to create a custom header. You can use that to set "Content-Type: text/xml"
-
Thanks again for your help @Ray Deck.
I added the custom header to my workflow (Content-Type: text/xml). Unfortunately, I am still receiving the "Invalid Content-Type" error from Twilio.
When I check Xano, it shows the response to include "Content-Type: application/json" and not the new custom header "Content-Type: text/xml"
Here is my function stack:
And here is the expanded response:
Thanks again for your help.
-
OK, that response looks weird in the screenshot. Can you open it up, and make the response jsut blank, and return as "self". That will make the end point be "NA" as "self" and maybe we get a different result
-
Sure thing - here is the new endpoint:
Xano response:
Unfortunately, same error in Twilio:
-
So I tried putting the folloiwng into the response:
<Response></Response>
When I did, the header took. Otherwise, I think Xano or its Nginx proxy are detecting a non-xml response and replacing the output.
Which webhook type are you using that requires a blank body (as opposed to a blank Twiml response, which is what I put into the code block above) -
Awesome, thanks @Ray Deck. I added the response and the new Content-Type worked. Also, I have stopped receiving the Twilio errors. Thanks a lot.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback