0

I am listening to incoming call on one of my endpoints and trying to generate a twilio response to forward that email to few other phone numbers. I also want to have action tag configured for each of this messages. My xml looks something like this -->

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Message action="https://test-5411.twil.io/test-log" to="+1831273xxxx" from="+1516407xxxx">
Hello 1!
</Message>
<Message action="https://test-5411.twil.io/test-log" to="+1831555xxxx" from="+1516407xxxx">
Hello 2!
</Message>
<Message action="https://test-5411.twil.io/test-log" to="+1831444xxxx" from="+1516407xxxx">
Hello 3!
</Message>
</Response>

Twilio docs say that -

There are certain situations when the TwiML interpreter may not reach verbs in a TwiML document because control flow has passed to a different document. This usually happens when a verb's 'action' attribute is set.

I think I am running into this exact situation. In my case, only the first phone number receives the SMS and the other 2 don't. Is there a workaround for this ?

user1952143
  • 155
  • 1
  • 10

1 Answers1

2

Twilio developer evangelist here.

I had a play around with this and in this case you are right that using an action will mean that the subsequent <Message>s won't ever be reached. I also tried putting further <Message> elements in the response to the webhook to the action, but that didn't work either.

So the workaround here is to use the REST API to send the messages instead of using TwiML.

philnash
  • 70,667
  • 10
  • 60
  • 88
  • thanks for the answer. When I use the REST API, do you know if the rate limit of 1 message per second will apply in this use case (I will have to send the 3 messages in 3 seconds) ? Or the rate limit is enforced at a per outgoing number message, so I will be able to send all three messages together and rate limit wont apply as they are sent to different phone numbers ? – user1952143 Jan 25 '22 at 18:50
  • 1
    The rate limit, whether sending messages via TwiML or the REST API, will apply and the limit is based on the number you are sending from, not the number you are sending to. – philnash Jan 26 '22 at 23:38