I store sent messages in a log table with their unique SIDs. With a periodic console task I iterate over the records having status = undelivered
and request the status of it and if it's still undelivered
, I'd like to re-send that very message. I don't want a new one as the message contains a verification code and we store only hash of it. Is it possible to re-send the old message having its SID?
Re-send a Twilio SMS Message
1.2k views Asked by Alexey At
1
Twilio Developer Evangelist here,
There is not a way to automatically resend an undelivered message using the API. You can work around this by grabbing the messages by SID and sending the undelivered ones again to the same number with the same body. When you use the REST API to get a message by SID, you have access to all of the data from that message, including the exact message body.
A quick example using the Twilio PHP Library would look like this:
You can see all of the data that the REST API gives you about messages here