Twilio How to collect incoming SMS messages using .net efficiently - vb.net

I created an application in VB.net that ties into a scheduling software. It keeps our employees up to date by sending them SMS updates. Employees can reply back to us. Sending messages works great. The application uses the Rest API to connect to Twilio. I can also get a list of incoming messages but I can't seem to get it in a way that works well for me.
Currently my application checks if there are new messages every 5 minutes. The application gets the messages list (with filter DateSent>=today) and then loops through the messages and copies the new ones into our scheduling database.
Is it possible to do a more efficient data pull for new SMS messages using VB.net only? Can I include a time filter in addition to current filter DateSent>=today to limit the result set? Any suggestions? (I don't do web coding unfortunately) Thanks.

Twilio evangelist here.
The best way to do this is just to use Twilios web hook to let Twilio proactively tell you each time its received a message. Whats a web hook you ask? Great question.
A webhook is simply an HTTP request that Twilio will make as soon as it received an inbound SMS messages to your Twilio phone number. You normally tell Twilio to make this HTTP request to a URL that you've created and published to a public website, which you can set up easily by using something like ASP.NET. In this scenario you can think of Twilio like a web browser that is making a request to a web application that you have created.
You can tell Twilio what URL it should request by opening the Numbers tab in your Twilio dashboard, and then locating and clicking the phone number you want to configure:
Now you set the URL you want Twilio to request in the Message Request URL field and click Save:
Now when Twilio requests this URL its going to pass a bunch of parameters with its request that you can use in your application logic. You can also do things like return TwiML back to Twilio in response to its HTTP request that tell it to do things like send an SMS right back to the person who just sent one to you.
If you're looking for a bit more of a step by step, the Quickstarts on our website are pretty easy to follow and will walk you through both sending an receiving text messages. The samples are in C# but are pretty straight forward so converting to VB.NET should be easy.
Hope that helps.

I am doing something similar with VB.Net and Twilio. My solution was to put up an Azure web site and an Azure SQL Database (the two can talk to each other). I set up my Twlio to call an .ashx asp.net web page on my Azure web site. Inside of that web page I have code that reads the incoming text message and saves it to my Azure SQL Database.
Works great, but my problem is the Azure database is in "the cloud" and my app\database that sends the original SMS is on mylocal network. Not sure how to cross that divide... (I should add that my local app can read the Azure SQL database, but seems ugly to have to call out to the Azure to get data. Would have preferred to have just saved it in my local db to begin with.)
Probably not a very helpful post, but maybe give you some architectural ideas. If you want to see my .ashx page just let me know.

Related

How to send alerts in elastalert to a api exposed in our application

We have used elastalert to monitor logs in elasticsearch.
If I configure email I get the mail and everything is working as expected.
Now the ask is to send the alerts to an API that is exposed in our application. So that this API will get the alert and work on it..
As far as I searched the alert can be sent to email,slack,MS teams etc but how to send it to some URL.
Any help on this will be really appreciated
Thanks in advance
Read this part in the doc :
HTTP POST
here : https://elastalert.readthedocs.io/en/latest/ruletypes.html
This alert type will send results to a JSON endpoint using HTTP POST. The key names are configurable so this is compatible with almost any endpoint. By default, the JSON will contain all the items from the match, unless you specify http_post_payload, in which case it will only contain those items.
...

soundcloud api how get clientId

On page https://developers.soundcloud.com/
Register a new app (Currently unavailable)
A question for developers. How soon will fix the registration of apps?
Is it possible to register my application in manual mode?
I need my clientId!
Apparently they haven't given out new client IDs for months (another user says so).
To answer your question though, no. As Soundcloud says when you attempt to register an app, "...we will no longer be processing API application requests at this time."
I'm trying to use the API too. It seems like we either need to use client IDs belonging to other people, wait an unspecified period of time, or there may be select uses of their API that don't require a client ID.
It depends on what kind of content you want to access.
If you need only public content than you can obtain the CLIENT ID from your AJAX requests made to soundcloud. Open network debugger in your browser and explore AJAX requests you should see some queries made to api.... and the query string should contain client id:
https://api-v2.soundcloud.com/tracks/687584815/playlists_without_albums?offset=85&limit=5&client_id=xxxxxxxxxxxxxxxxxxxx
Hope that helps.

Callback service on the website using Twilio

Let's say I need to implement a callback service on a website.
I'm curious if it's possible to develop it using Twilio.
For example, if a website visitor provides his mobile phone number from one side, from another side I have a manager using his web CRM application. Is it possible to:
Make a call (using WebRTC?) to a manager
When the manager replies the incoming call, call to the website visitor (on his mobile phone)
Connect both sides together
I know there are lots of ready-to-use callback services, I'm just curious how it works under the hood.
Twilio developer evangelist here.
This is a feature we call Click to Call. Here's how it would work with Twilio:
The visitor provides his number through a form on the site
Generate a call to the manager using the Twilio REST API
When the call connects to the manager, dial the visitor.
This is achieved using TwiML
Whent the call connects, Twilio makes an HTTP request to a URL you provide in step 2
That URL needs to respond with TwiML, which is a subset of XML to tell Twilio what to do with the call
In this case the TwiML would be to <Dial> the visitors number
When the visitor answers the two are connected
This is a high level view of it, we also have a tutorial walking you through Click to Call with Twilio (this is the Python version, but there are others available too) which I recommend you take a look at.
Let me know if this helps at all.

How to push something to user in a rest API?

We already have a system in place that uses Restful APIs in order to send let's say SMS. All of our clients are using our server to send their requests to Rest API so we drop connections except our server IP to handle authentication.
Now policy has been changed. We want to expose our APIs to the outside world. We now want to be able to push to user under specific circumstances. Let's say that I want to send a delivery report to the user when SMS has been delivered. Or when something has been scheduled for a specific time, when that time arrives user get notified.
How to handle these notifs? Has anyone used the same or similar approach?
Assuming you can reach your clients back via HTTP. The model to do this is to use callbacks. When someone posts a scheduled job on your server, they should also post a callback URI where your server can notify when the job is complete.
Sample below:
https://schedulingSevrer.com/runSchedule?callback=http://clientserver.com/reportStatusHere
So when the job is done your callback will be like
http://clientserver.com/reportStatusHere?jobId=12345&status=complete
Or if your clients are mobile apps on Andorid you can use the Google Push notifications.

PHP script to send and retrive sms from a website

I'm not sure where to begin, but got a case I need help from others where and if possible to solve.
Thing is, got a new alarm system at home, this system uses sms function so I can send a short code to my alarm asking for status if it`s ON or OFF, or i can turn it on/off from an sms.
Since both the sms number and code is strictly personal, I would not like to tell my carpenter the codes, but in the mean while he is working at my home, I can give him a login to my site, where he can see if the alarm is turned on or even turn it on/off by him self.
I would like to build me a website, that does the same.
Got a login to my site, when logged in, i would like the website to send an sms automatically, then retrieve the answer and display it on the website.
Is this even possible ? If so, anyone can past me in the right direction here ?
Thanks in advance =)
You can send an SMS from a website. Most mobile operators will gladly offer you an apropriate API.
For instance Deutsche Telekom has an API called "Developer Garden" that allows you to send SMS via a WebService and much more.
see here for an example: www.developergarden.com
Other providers may also offer such services.
you need an sms gateway ( we use these guys : http://inteltech.com.au/, but nearly any will do )
Your easiest option is to find one where you can insert SMS'es for sending via a URL, eg in our case the URL looks like this:
http://inteltech.com.au/secure-api/send.single.php?username=[user]&key=[longcode]&method=http&senderid=[id]&sms=[phonenumber]&message=[here's the message]
it's extremely simple to use. If your site handles the login otherwise, then you can use this for the rest.
Now, how to receive SMS'es is a bit tricker :)
But this provider, for example, offers you options to;
Send the reply as an email to a nominated email address.
Send the reply as an email to the original user who sent the message.
Send the reply as an SMS to a nominated mobile number.
POST the reply to your website or application . e.g. We can call a http/https request to your script
as you can see, both the email and the POST options are providing great ways to integrate.
I'd say if you don't handle incoming email already, then stick to the POST method.
voila :)