Fetch MessgaeSid (SmsSid) of the message i send. When Someone replies to my message

StackOverflow https://stackoverflow.com/questions/22506380

  •  17-06-2023
  •  | 
  •  

Вопрос

I am Developing a Sms Convesation Application using Twilio API. What My Application does is It Send SMS to Mobile device prompting some options to chose. Users should reply back with anyone of the given option. What i want is when someone replies back to my application, I want the MessageSid of sent message(Message sent from Application). How can I acheive this? Please Help me

Это было полезно?

Решение

Twilio evangelist here.

There is no way to get the sid of a previous message from an inbound message since we don't track that. The SMS protocol has no facility for a "conversation" in it so we don't know that the inbound message is a "reply" to anything.

What you need to do is store in your app the fact that you sent a text message to a specific phone number. Then when that user replies from that number you would be able to know that you had previously sent them a message.

Hope that helps.

Devin

Другие советы

I don't believe this is possible. SMS messages are "stateless", much like HTTP requests. The only thing you could use like a session id would be the phone number. What about tracking conversation history by mapping an array of MessageSids to the phone number?

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top