Reputation: 36638
I use the following to get a list of recent messages - both incoming and outgoing - from Twilio:
$twilio = new Services_Twilio(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN);
$twilio->account->messages->getPage(0, 300);
I can search for all incoming messages from a particular number with:
$twilio->account->messages->getPage(0, 300, array(
'from' => 19994442222
));
And vice versa by changing the from
key to to
.
How do I search for all incoming and outgoing messages related to a particular number?
Upvotes: 0
Views: 238
Reputation: 73029
Twilio developer evangelist here.
You'll have to make separate requests to get the messages to your number and from your number as you described, there's no way in the API to get messages that are to or from a number.
Alternatively, you could set up the number on its own under a subaccount and just requests all messages from that subaccount, thus retrieving only messages to and from that number.
Let me know if that helps at all.
Upvotes: 0