Reputation: 10189
One of our users (probably accidentally rather than maliciously) put in Lyft's SMS service number as her phone number. As a result, our SMS text service is interacting with Lyft's SMS text service in a loop. See logs below:
I wonder if there is a way to detect this kind of machine-to-machine SMS loop and prevent it from happening. We are using Twilio API to power our SMS auto-response system and so does Lyft.
Upvotes: 1
Views: 719
Reputation: 3811
You're experiencing the following: https://www.twilio.com/docs/api/errors/14107
A counter is set for each outbound TwiML reply in a conversation (between two numbers). When the first reply occurs, the counter starts at 1. If the next reply is sent less than 15 seconds after the prior reply, then the counter goes to 2. This will continue if each reply is less than 15 seconds, until the counter surpasses 20, where Twilio will put a hold on any messages sent for 30 seconds and throw this error.
You might consider using the Lookup API to try and detect service numbers which you may or may not be successful at depending on the criteria.
I would suggest that you try an example request and response on this page with the number in question and take a look at the returned parameters to decide whether or not this could have helped in this scenario.
Upvotes: 2
Reputation: 10420
Just make a change in your app logic that would stop replying after a set number of identical messages (store a hash of every message in memcache for a few minutes or something like that.) There's no metadata to SMS messages that would allow you to conclusively identify the originator as another automated service.
Upvotes: 3