Hacker News new | past | comments | ask | show | jobs | submit login

I'm going to have fun writing my contest entry.

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>




Hi Zackattack,

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


Cool, thanks for getting back to me so quickly.

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).


Twilio only hits your URL when somebody sends an SMS to your phone number. So in the #1 scenario, if you sent a message via the REST API, Twilio wouldn't hit your URL. If the person replied, then your URL would be hit.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: