Twilio webhook sms response format

后端 未结 1 1039
猫巷女王i
猫巷女王i 2021-01-19 13:40

I\'m using Twilio with my app and I have sms webhooks with my SMS numbers configured with URL. Everything is working except that Twilio send me an error in logs for each req

相关标签:
1条回答
  • 2021-01-19 13:56

    Twilio developer evangelist here.

    When you return a webhook message to Twilio, you need to make sure it's valid TwiML, which in essence is just a set of XML verbs Twilio uses.

    If you're responding to an SMS message for example, you would return TwiML as follows:

    <?xml version="1.0" encoding="UTF-8"?>
    <Response>
        <Message>Thanks for getting in touch, I'll call you later</Message>
    </Response>
    

    You can test the code above by changing the configuration of your number to point to this url and you should stop seeing the errors.

    If you generating the TwiML yourself, you need to make sure that the page's MIME type is text/xml.

    Hope this helps you out.

    0 讨论(0)
提交回复
热议问题