Ofershap
Ofershap

Reputation: 717

Tracking outgoing twilio sms messages for identify when replying

I'm using twilio service with nodejs server for my chat app, and i'd like to create a connection between my app and end users using sms messages.
I'm using this code in node.js to send an sms message:

    client.messages.create({
    to: to,
    from: "+MY_TWILIO_PONE",
    body: body
}, function (err, message) { ... }

and it's working fine. My problem is that when a user reply this message, i can't find a single id that connects his incoming sms to the outgoing message. I must mention that i'm using a single twilio phone number for sending all outgoing SMS messages.

Searching on Twilio docs and over the web offers to use cookies in order to store the conversation, but this is a solution that works only if the first message was sent from outside the app, and not vice versa.

Can you suggest me how can i solve this issue?

Upvotes: 1

Views: 1256

Answers (1)

philnash
philnash

Reputation: 73029

Twilio developer evangelist here.

I'm afraid there's no way to track a direct response to an outgoing SMS message from the Twilio API.

Have you considered just associating the SMS responses based on the number you sent them to? If you store the details of the sent message and the number you sent it to, then you can check the from number of an incoming message and associate it that way.

Does that help at all?

Upvotes: 1

Related Questions