smstwiliooutboundinbound

Receiving two-way SMS messages with Twilio and Link Inbound message with Outbound message


We are using Twilio for sending outbound message to our customers. When we send Outbound SMS to Customer then we are storing Outbound message details in our Database.

Also we have implemented Inbound SMS. So if we receive any inbound SMS from customer then we are creating inbound message record in database.

Now our requirement is that if sent a sms to Customer and then customer replied to that outbound message then we have need to store Inbound SMS under Outbound SMS, so we can relate inbound message with Outbound message.

Is there any way to identify in twilio that inbound message that we have received is related to which Outbound message (may be can we use any unique identifier)?

Thanks,

Raj


Solution

  • Twilio developer evangelist here.

    There is no affordance in SMS to reply to specific messages. You can see this yourself by opening your SMS app on your phone and trying to reply to the second to last message you received from someone. It's simply not possible.

    So, you can either make the assumption that if you have sent a message to a user that their next inbound message to your number is in response to that.

    Or, you can use multiple numbers to send different messages, associating responses based on the number that sent/received the message.

    Hope that helps.