September 18, 2009
Here we have a sample demo of sending and receiving SMS (text messages) in real-time using APE‘s libape_controller. We also utilize an SMS gateway called Esendex which is a UK based company – hence the name EsenAPE. When a message is sent to Esendex (e.g. you reply to the text you sent yourself) it will call a URL (RPC.php) we can then pass this onto APE for updating the users UI. The idea originated from a project I’ve just completed with work, Alert and Respond which basically does what this demo does but not in real time (polls every 30 seconds). It’s a good example of how to use the libape_controller – let me know what you think
This is just a proof of concept and shouldn’t be taken as a full application, it’s easy to use; enter your mobile number (with country code!), enter your message and click send. Once you’ve received the message on your phone you can reply to it and within seconds it’ll appear in your browser!
Please download the source and view my comments. Also, as SMS credits costs money I have only 20 remaining on the account so please only send one/two otherwise your IP address will be meeting my iptables. You can reply to the text as many times as you want.
Just a small note; I’ve tested this from the UK and SMS’ take less than one second to arrive to my phone and around 2 seconds until they appear on the screen of EsenAPE when I reply. innociv (from the USA) sent an SMS to his phone and took around 3 seconds. Please don’t forget to use your country code (001 for the USA).
Tags: ajax, APE, DUI, Esendex, Javascript, jQuery, Object Oriented, PHP, SMS
© 2013 Paul's Blog
Nice app, it works perfect here in Denmark, even our “special letters” work (Æ Ø Å).
It could be nice if one’s mobile-service-provider had something like this, especially the recieve function.
Nice app, it works perfect here in Denmark, even our “special letters” work (Æ Ø Å).
It could be nice if one’s mobile-service-provider had something like this, especially the recieve function.
I’m thinking of implementing something similar to this for a community radio station in Kent. I’d like to have a look at how your code works, but unfortunately your links are broken!
I’m thinking of implementing something similar to this for a community radio station in Kent. I’d like to have a look at how your code works, but unfortunately your links are broken!
Hi Fish, my apologizes. I recently upgraded to APE v1.0 and totally forgot about the old demos, they should work fine now so test away
Cool, thanks for that! Works like a charm. Most impressive. I’ll pingback if we get something working based on this
Yeah, it’s pretty damn fast as well. Just keep in mind this is pre-APE 1.0 so it’ll need some minor code changes but if you need a hand at all I’ll be glad to help
Hi Fish, my apologizes. I recently upgraded to APE v1.0 and totally forgot about the old demos, they should work fine now so test away
Cool, thanks for that! Works like a charm. Most impressive. I’ll pingback if we get something working based on this
Yeah, it’s pretty damn fast as well. Just keep in mind this is pre-APE 1.0 so it’ll need some minor code changes but if you need a hand at all I’ll be glad to help
I’m going to have to make some significant changes to the PHP, since we use AQL.com to do our inbound SMS (it’s 10x cheaper to get an inbound number from AQL as opposed to Esendex).
We’re also looking at having a larger scope – so not just SMS but also RSS feeds, email, twitter updates and more, all going into the same inbox.
We are also going add to it by having historic messages get loaded up on startup. We’re logging all the messages in a DB, so we’ll have to figure out how to do that.
This will be the first thing I’ve done with APE, ha!
I’m not sure about AQL’s API but with Esendex they provide a callback URL which makes the receiving of SMS’ lightning fast.
APE can definitely handle all of that without any problems
SSJS makes DB calls very easy and fast. The guys over at #ape-project on FreeNode are very helpful if you’re not too sure as their API doc isn’t complete yet!
AQL do the same – callback via HTTP POST*. It’s very quick – but our existing solution slows it right up. We generate a RSS feed from the logged messages, which gets updated on the client end when the RSS feeds are refreshed.
All this polling is pretty nasty – if we wanted it to be as fast as this we’d need to poll the feed once a second. Not very scalable at all. Thus why I’ve looked into AJAX Push/Comet servers.
I’m already on the #ape-project channel, I suspect I’ll have plenty of questions come tomorrow!
* Not to mention they’ve got IAX2 trunks so we can have people call the number and it’ll hit our PBX. Having one number to read out on air is a sure way to win the execs
I’m going to have to make some significant changes to the PHP, since we use AQL.com to do our inbound SMS (it’s 10x cheaper to get an inbound number from AQL as opposed to Esendex).
We’re also looking at having a larger scope – so not just SMS but also RSS feeds, email, twitter updates and more, all going into the same inbox.
We are also going add to it by having historic messages get loaded up on startup. We’re logging all the messages in a DB, so we’ll have to figure out how to do that.
This will be the first thing I’ve done with APE, ha!
I’m not sure about AQL’s API but with Esendex they provide a callback URL which makes the receiving of SMS’ lightning fast.
APE can definitely handle all of that without any problems
SSJS makes DB calls very easy and fast. The guys over at #ape-project on FreeNode are very helpful if you’re not too sure as their API doc isn’t complete yet!
AQL do the same – callback via HTTP POST*. It’s very quick – but our existing solution slows it right up. We generate a RSS feed from the logged messages, which gets updated on the client end when the RSS feeds are refreshed.
All this polling is pretty nasty – if we wanted it to be as fast as this we’d need to poll the feed once a second. Not very scalable at all. Thus why I’ve looked into AJAX Push/Comet servers.
I’m already on the #ape-project channel, I suspect I’ll have plenty of questions come tomorrow!
* Not to mention they’ve got IAX2 trunks so we can have people call the number and it’ll hit our PBX. Having one number to read out on air is a sure way to win the execs
Hy paul..
I’m Iwan from indonesian
I can’t test in your demo..
how can it work..
Hy paul..
I’m Iwan from indonesian
I can’t test in your demo..
how can it work..
is the sms working?
is the sms working?
Hi Iwan/Ronald, the SMS test account ran out of credits but I’ve just topped it back up with another 25 so go a head and give it a try.
Regards, Paul.
Hi Iwan/Ronald, the SMS test account ran out of credits but I’ve just topped it back up with another 25 so go a head and give it a try.
Regards, Paul.
How can I pass my user’s identity from PHP to APE? I would like to add something like this to my application, but I have to lock down the people to whom each user can send a message. I can’t just pass the userid in from PHP, because that can be easily spoofed. I am thinking something like sharing session info between PHP and APE. Can you point me in the right direction
Hi Ronald, I don’t have much experience with sessions, APE and PHP but maybe this is of use;
http://www.ape-project.org/wiki/index.php/Tutorial:Using_sessions
Thanks for responding so quickly. Maybe my question is simpler than this. I just need to be able to associate the authenticated user with his APE channel so that he doesn’t have to authenticate again.
How can I pass my user’s identity from PHP to APE? I would like to add something like this to my application, but I have to lock down the people to whom each user can send a message. I can’t just pass the userid in from PHP, because that can be easily spoofed. I am thinking something like sharing session info between PHP and APE. Can you point me in the right direction
Hi Ronald, I don’t have much experience with sessions, APE and PHP but maybe this is of use;
http://www.ape-project.org/wiki/index.php/Tutorial:Using_sessions
Thanks for responding so quickly. Maybe my question is simpler than this. I just need to be able to associate the authenticated user with his APE channel so that he doesn’t have to authenticate again.
Hi Paul:
A good job, with your permission I will leave a link to your sources LasFiguritas.com, but will use to explain what is APE.
Sorry for the text-translation of Google
Hi Paul:
A good job, with your permission I will leave a link to your sources LasFiguritas.com, but will use to explain what is APE.
Sorry for the text-translation of Google
Hello Paul,
have you tested any of your APE examples in chromium?
Open up the inspector in the “network” tab and you’ll see that there’s an infinite “wait” for 0.ape.ifc0nfig.com which makes it look as though the page never fully loads. Firefox doesn’t have that problem. Any ideas on how to HIDE this “feature” ?
Hello Paul,
have you tested any of your APE examples in chromium?
Open up the inspector in the “network” tab and you’ll see that there’s an infinite “wait” for 0.ape.ifc0nfig.com which makes it look as though the page never fully loads. Firefox doesn’t have that problem. Any ideas on how to HIDE this “feature” ?
Hi,
How to configure server side files
e.g for http://www.ape-project.org/demos/5/live-tweets.html
Hi,
How to configure server side files
e.g for http://www.ape-project.org/demos/5/live-tweets.html
Hi,
Can I use your source code and insert my sms settings. I tried testing the Demo but nothing has happened. Please if you still support the application, respond.
Thank you.
Hi,
Can I use your source code and insert my sms settings. I tried testing the Demo but nothing has happened. Please if you still support the application, respond.
Thank you.