Sorry, you need to enable JavaScript to visit this website.

You are here

Retrieve SMS responses and getting all pending replies

1 post / 0 new

David's picture
by David

Retrieve SMS responses and getting all pending replies

A developer recently had a question on message responses;

The /messages/sms endpoint only returns the (one) oldest unread reply even though its documentation titles it as “Retrieve SMS Responses". Is the expected practice if I want to receive all pending replies to call /messages/sms repeatedly to read them in one by one until a status of “EMPTY” is returned?

Answer: When polling/requesting message responses, you will retrieve the NEWEST first. Then further retrievals will get the next newest in the queue (if there’s other responses there waiting, otherwise you’ll get “EMPTY”).

Now, here’s where it gets a little tricky…

If you set a notifyURL (aka callBack URL) on the GET provisioning call, then all responses will be sent instead to that URL that you specified. As a result, if you did set a notifyURL, then manually polling for a message response will return “EMPTY” as it’s sent all these responses to your notifyURL.