SMS conversations and replies - django app

I have a django app where users can send out sms to their contacts (telephone numbers, not users of my app). I am trying to implement a system where if someone replies to a specific text, such reply is forwarded to the user that started the thread.

I implemented an inbound webhooks to receive sms but I am now facing a problem: how do I know which text is a reply replying to? I can't seem to find any type of id in the sms inbound request and I am now starting to fear that this is just impossible.

Any idea? Should I try to use "Conversations"? Would that solve my problem and if so, how should I go about it?

Answers

  • Hi, @nmacchitella ! Sorry you're having trouble. I'm far from the django or SMS expert, but I may know someone who can help. Lemme ping them. In the meantime, do you think you could:

    • Post your current code that's giving you trouble, if you can do so safely and without sharing SIDs?
    • Scan through the SMS docs and let me know if there's anything here that is almost right for solving your problem, or what documentation seems to be missing that would've gotten you to the answer right away?

    I'm pretty sure what you're describing is possible so don't lose hope! We'll figure it out :D

  • Hi CSunu,

    Thanks a lot for your reply! After diving into the documentation I had an even stronger feeling that there isn't really a way to connect a sms sent to a user with the user's response if not from the fact that they are sent from and to the same two numbers.


    Basically, let's consider this scenario

    • I have a Twilio number (Number X) and another number of a random user (Number Y)
    • Number X send a message to Number Y (message_1) asking if they want to opt-in for a certain campaing.
    • Hours later, Number X send another message to Number Y (message_2) asking if they want to opt-in into aanother
    • A few hours later more, Number Y send a message to Number X (message_3)

    I can't really know if message_3 is a reply to message_1 or to message_2 cause they will come in as simply belonging to the same chat. And I don't think there is a way to make messages coming from X and going to Y going into separate threads depending on a ID that I set

If this is an emergency, please contact Twilio Support. This is not an official Support channel. https://support.twilio.com/
Have an urgent question?
Please contact Twilio Support. This is not an official Support channel.
Contact Support