by zackattack · 16y ago · 0 comments
Check out [http://www.twilio.com/docs/quickstart/sms/tracking-conversat...]. It says that the session variable is stored as the context between two numbers. Is that a unique pair, or is it a direction pair?
In other words, is the $_SESSION between $_REQUEST['From']=='Zack' && $_REQUEST['To']=='HN' the same as the $_SESSION between $_REQUEST['From']=='HN && $_REQUEST['To']=='Zack?
If that's the case, then the example provided in your documentation is flawed, because you're saying:
A) <Sms><?php echo $name ?> has messaged <?php echo $_REQUEST['To']." ".$counter ?> times</Sms>
When you really mean
B) <Sms><?php echo $name ?> has messaged OR BEEN MESSAGED BY <?php echo $_REQUEST['To']." ".$counter ?> times</Sms>
It's bi-directional... ie, cookie state for the conversation. But in the quickstart, if you think about it... you only increment the counter once for the received message and the reply that the script is going to send, so the counter works out correctly. You had us thinking for a few minutes there :)
-jeff @twilio
To clarify, the API/platform supports the following two scenarios:
1) You make an HTTP POST to the SMS resource 2) Twilio automatically sends out a text message, and simultaneously does a GET/POST of your script, and $_REQUEST contains "From", "To", and "Body" keys
AND
1) Your Twilio phone # receives a text message 2) Twilio automatically pings your script, and inside the ping, $_REQUEST contains "From", "To", and "Body" keys. The value of the "To" key is always your Twilio phone number. (Unless you have multiple Twilio #s, I suppose).