Jeff Salter
Posts: 0
Joined: Sun Jul 05, 2015 2:30 pm

Filter Twilio messages on showMesssages service

How can I filter incoming messages showed from twilio?

I want to show only messages to a specific number that is saved in my userData array."UserData" "twilioNumber"

But don't know to make a reference to the "to" in the "sms_messages"? or even if I can do a query on that item?

Jeff Salter
Posts: 0
Joined: Sun Jul 05, 2015 2:30 pm

Filter Twilio messages on showMesssages service

I think a workaround is for me to save all messages on the get listing to the database and sort them there for now, though it would be helpful to just grab the ones accociated with the users twilio assigned number. For now I can filter the list based on the user. Here is what I have to get the messages and then copy them to database. my problem is that I am getting a blank unsure how to getting the following for my twilio value: [object Object]. So I have something wrong.

var items = jQuery('[name="mobilelistitem_7"]');
for (var i = 0; i < items.length; i++) {

Code: Select all

 var item = jQuery(items[i]).closest('[name="mobilelistitem_7"]'); 

 localStorage.setItem("twilio", item); 

 storemessage.execute(); 

}

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Filter Twilio messages on showMesssages service

Hello Jeff,

Please read this article first https://www.twilio.com/help/faq/sms/c...

Show us your service settings and a few rows of database.

Where do you use this code?

Jeff Salter
Posts: 0
Joined: Sun Jul 05, 2015 2:30 pm

Filter Twilio messages on showMesssages service

I'm trying to just filter the response for now, then once that is done I can figure out how to write to the db. Here is a screenshot of my current filter value. I know it is wrong and I don't know the proper coding.

Image

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Filter Twilio messages on showMesssages service

Hello Jeff,

You can add "read list of sms" service: https://www.twilio.com/docs/api/rest/... As you can see there aren't "where" parameter, please use allowed parameters.

Jeff Salter
Posts: 0
Joined: Sun Jul 05, 2015 2:30 pm

Filter Twilio messages on showMesssages service

I found that if I changed the URL on the GET to:

//api.twilio.com/{version}/Accounts/{accountSid}/SMS/Messages.json(userNumber}

But now I need to understand how to set the userNumber in Twilio_settings based on the user number in my storage.

Image
Image

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Filter Twilio messages on showMesssages service

You can change Twilio settings anywhere in app via JS:

Twilio_settings.phoneNumber = "+123455678900";

Return to “Issues”