Twilio API / TWIML when a user responds to my text (via text) and i receive their answer to my end-point, how do i identify the sender?
at first i thought it would be the 'sid', but it is not.. I cannot find an 'conversation_id' that exists both in the 'sending' and the 'responding' that could alert my end-point who the sender is.
when i send a text from my server, the response looks like:
{ sid: 'MMf9...',
date_created: 'Thu, 18 Aug 2016 03:24:50 +0000',
date_updated: 'Thu, 18 Aug 2016 03:24:50 +0000',
date_sent: null,
account_sid: '...',
to: '...,
from: '...',
messaging_service_sid: '...',
body: 'Hi. this is an anonymous text from my server',
status: 'accepted',
num_segments: '1',
num_media: '1',
direction: 'outbound-api',
api_version: '2010-04-01',
price: null,
price_unit: null,
error_code: null,
error_message: null,
uri: '/2010-04-01/Accounts/...../Messages/......json',
subresource_uris: { media: '/2010-04-01/Accounts/...../Messages/...../Media.json' },
dateCreated: Thu Aug 18 2016 03:24:50 GMT+0000 (UTC),
dateUpdated: Thu Aug 18 2016 03:24:50 GMT+0000 (UTC),
dateSent: null,
accountSid: '....',
messagingServiceSid: '.....',
numSegments: '1',
numMedia: '1',
apiVersion: '2010-04-01',
priceUnit: null,
errorCode: null,
errorMessage: null,
subresourceUris: { media: '/2010-04-01/Accounts/..../Messages/..../Media.json' } }
When I respond with a text from my phone back to my server, my end-point receives...
{
"ToCountry": "US",
"ToState": "IL",
"SmsMessageSid": "SMe....",
"NumMedia": "0",
"ToCity": "Chicago",
"FromZip": "60626",
"SmsSid": "SMe....",
"FromState": "IL",
"SmsStatus": "received",
"FromCity": "CHICAGO",
"Body": "Try",
"FromCountry": "US",
"To": "....",
"MessagingServiceSid": "....",
"ToZip": "",
"NumSegments": "1",
"MessageSid": "SMe...",
"AccountSid": "...",
"From": "...",
"ApiVersion": "2010-04-01"
}
as you can see the sid in the original sms starts with MMf9... and all the ids in my phone's response start with SMe...
I was hoping for some conversation-id in the sending and responding would be there so that on my end-point, i could create a database entry for the conversation, and store the response of my user from the conversation. But now since there is no conversation_id between sender & receiver, I have no idea where to store the conversation and i have no idea who my server is sending responses to.