Page 1 of 1

Filter Twilio messages on showMesssages service

Posted: Wed Jul 15, 2015 3:15 am
by Jeff Salter

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?


Filter Twilio messages on showMesssages service

Posted: Thu Jul 16, 2015 4:49 am
by Jeff Salter

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(); 

}


Filter Twilio messages on showMesssages service

Posted: Fri Jul 17, 2015 10:59 am
by Alena Prykhodko

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?


Filter Twilio messages on showMesssages service

Posted: Sun Aug 02, 2015 9:49 pm
by Jeff Salter

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


Filter Twilio messages on showMesssages service

Posted: Mon Aug 03, 2015 11:53 am
by Serhii Kulibaba

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.


Filter Twilio messages on showMesssages service

Posted: Mon Aug 03, 2015 12:01 pm
by Jeff Salter

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


Filter Twilio messages on showMesssages service

Posted: Sun Aug 09, 2015 8:00 pm
by Serhii Kulibaba

You can change Twilio settings anywhere in app via JS:

Twilio_settings.phoneNumber = "+123455678900";