Reputation: 535
We have a situation where our server is located on a mobile trailer using AT&T broadband. AT&T is double NAT'd so there is no way for me to open any ports and allow inbound traffic in.
(We are looking into static IPs but could be a long time coming.)
Is it possible to make a call to twilio to say "give me any new messages from this date" Or is it all based on the webhooks?
Upvotes: 0
Views: 120
Reputation:
Is this for SMS? You ordinarily do not need a server to make HTTP requests to a REST API. I can't find it after a cursory look in their docs, but what you are looking for is a page that lists all the HTTP endpoints and their cognate request method. From there, use a library like requests
or http.client
or urllib
to send the requests.
Edit: this post is geared for the Pythonistas
Upvotes: 0
Reputation: 10366
Twilio evangelist here.
Yes! You can use the REST API with date filters to get a list of messages. This is what that would look like in Node:
client.messages
.list({
dateSentBefore: new Date(Date.UTC(2019, 2, 1, 0, 0, 0)),
dateSentAfter: new Date(Date.UTC(2019, 0, 1, 0, 0, 0)),
limit: 20
})
.then(messages => messages.forEach(m => console.log(m.sid)));
You can find a more complete Node sample plus samples in other languages in our docs.
Hope that helps.
Upvotes: 2