Question

Photo of Don Smallman

0

Twilio Duplicates

Hi, is anyone else see duplicate SMS messages being sent from Twilio?  We are having that issue and I do not know if it is the RockRMS or Twilio that is the issue.

The cost of SMS is starting to add up.

  • Don Smallman

    This is what it says on the Twilio site.
    If you find duplicate messages sent within a few seconds of each other


    This means that Twilio sent multiple SMS messages to the carrier, and almost always means that Twilio received multiple POST requests from your app.


    If you do see that duplicate SMS messages were sent by Twilio, there may be a bug in your code that is making multiple POST requests to Twilio. Please check the HTTP request logs on your server as this may reveal more information about the requests sent to Twilio and will be a good place to begin investigating a possible bug.

  • Photo of David Turner

    0

    This is likely because the Rock communication block, and the Rock communication job are attempting to send the same message (we had similiar issue with SMTP communications that was fixed in 3.2). 

    On the Communication block there is a configuration setting for 'Send When Approved'. If this is set to 'Yes' then as soon as you click Send on a new communication ( SMS included ), the block will start a new thread to process the sending of that communication.  Meanwhile the communication job is always running looking for pending communications to send. It does have a 'Delay Period' setting which tells the job to only send communications that were created that number of many minutes ago ( this is so that idealy it doesn't try and send communications that the block may still be trying to send ).  Unfortunately with SMS messages, these two processes are currently not 'thread safe' and could each potentially grab the same recipient to send to.  We will fix this like we did with SMTP (email) sending so that the two process are thread safe and can run at the same time, but in the meantime you have two options for configuring those settings to prevent the duplicates.

    1. Set the 'Send When Approved' setting on the communication block to 'No' and the 'Delay Period' setting on the communcation job to 0. This will prevent the block from sending any communications, and will leave it entirely up to the job.
    2. Leave the 'Send When Approved' setting on the communicaiton block to 'Yes', but increase the 'Delay Period' setting on the communication job significantly to allow ample time for the block to finish sending to all recipients before the job starts trying to send them ( I'd suggest a setting of at least 60 minutes )

     

    -David

  • Photo of Trey Hendon III

    0

    Hey Don,

    I can't speak directly to this, but having just finished a custom Job which sends SMS, I know I did have some issues with duplicate messages.  More specifically, my code was sending the first person one message, the second person two messages, the third person three messages, etc.  Is that the behavior you are seeing?

    If so, this could be a bug.  (In my custom code I was able to clear the recipient info after each loop.)

    -Trey

    • Don Smallman

      Hi Trey! I'm not sure that is the same issue. I believe that our problem arises when someone sends a text that is greater than 165 characters. Some people get one, some get two and some get three. I am waiting until they send another mass text. I asked that they keep it at 165 or less, so I can verify my theory.

    • Don Smallman

      Trey, seems as if you and I are the only ones with this issue. I am not sure how to tell if it is RockRMS or Twilio, but I have submitted a ticket with Twilio.

    • Don Smallman

      No. That is what I thought, but after further testing, I found that even the shorter ones have dups. Twilio said that each dup is getting its own independent identification number. So it seems as if RockRMS is asking for some to be sent twice. Not sure what to do now. Especially if no one else is having this issue.


      Could it have something to do with Arvixe?

    • Trey Hendon III

      Not to point a finger to Arvixe, but it seems possible. Here's my guess for what could be happening.


      On my Arvixe install, I don't get notified of the Twilio webhook failing, but I do get emails from Mandrill saying the Mandrill webhook is failing - quite frequently. It seems very likely that if the webhook for Twilio failed, Rock might not be getting the "hey, I sent this" message from Twilio and Rock might try again.


      In Twilo, if you go to Monitor and select Alerts. Do you see messages about the SMS webhook failing?

    • Trey Hendon III

      Interesting. Not sure what to guess on that.


      Just to make sure before I crack into the code, this is the regular New Communication block, right?

    • Don Smallman

      We typically use a data view and then click on the "Communicate" icon to send email and text messages. Is that what you are asking? I have looked at the data several different ways and cannot find anything in common regarding the duplicates. Other than it only seems to happen with bulk texts.

  • Photo of Michael Garrison

    0

    We occasionally have duplicate text messages get sent out- but not all the time- it's quite the exception, rather than the rule.

    • Don Smallman

      Thanks Michael. I have opened a ticket with Twilio.


      How do you check to verify that you are not sending duplicates? Also, how many members are you texting at one time?

    • Michael Garrison

      My response didn't post, it seems, sorry.


      We send prayer request lists to between 50-75 members daily. My checking for duplicates is quite empirical- many of our staff members are on every day's list (to make sure they know when and that they are getting sent out) and I've only had one of them report to me that they got a duplicate message once.