Clickatell SMS Block

Clickatell SMS Block

by Phillip Franks -
Number of replies: 13
Hi,

Attached is a working block for sending SMS messages to users from Moodle (1.6,1.7 possibly others) via the Clickatell gateway. This was developed for the RCSI and we have been meaning to release it for a while now (http://moodle.org/mod/forum/discuss.php?d=35798#174050) but we only recently got around to tidying the code for release.

I'm aware that there is already a SMS interface/abstraction layer for Moodle in the works (http://julmajanne.com/stuff/docs/smslib.html). This package does not currently implement the SMS library and has no requirements beyond the basic Moodle installation. It may be useful to some people as an out of the box solution until the SMS library is fully integrated.

There's a README file quickly outlining installation and how to use.

Any questions, let me know!

Phillip Franks
Enovation Solutions
Average of ratings: -
In reply to Phillip Franks

Re: Clickatell SMS Block

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers
Hi Phillip, thanks for this block.

I've installed it with no problems and created an account at Clickatell. I *think* I've configured everything right, but the sms message sending is failing.

Is the Gateway Account ID in the block config settings the same as the api_id in Clickatell Product Control settings? And is it the COM API, the HTTP API or another one? Your help would be appreciated.

Thanks
Jon
In reply to Jon Bolton

Re: Clickatell SMS Block

by Phillip Franks -
Hi Jon,

Glad to see there's an interest in this. I hope you find the block useful.

The Gateway Account ID is indeed the API_ID. We are using the Clickatell Email interface so, the connection type in the Clickatell control panel should be "Email to SMS".

Also, there's an option on the block's settings panel to enter a "Receipt Email". If you enter your own email address in here, the Clickatell gateway will send you a report for every time you use it. It might reveal help reveal where the problem is.

Let me know how it goes

Phil

In reply to Phillip Franks

Re: Clickatell SMS Block

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers
Mm, strange. It's still not working. Here's what I did:

1. Block installs fine, and presents the links to sens SMS to Course, Group or People.

2. Created account on Clickatell, and created SMTP API. The details are api_id: 2873197, User: my username - password: my password.

3. Block admin configured to correct Clickatell account email address plus all the settings from above. I put in another (correct) email address for me for debugging.

4. On course page, I get a block which presents the links to sens SMS to Course, Group or People.

5. When I click on People, I get a screen with the SMS content box on the left and a list of people with valid mobile numbers on the right.

6. Tick one user (my test student account with my mobile in it's profile), enter some text in the SMS box and click "Send SMS"

7. Get confirmation message and option to Confirm or Cancel.

8. On Confirm, I get another screen showing that SMS failed for the following user(s): my test user account (presents correct mobile number)

9. Don't get any debugging email to email address

sad

I did have a thought... in the lib.php file there is a section of code for validating a mobile number based on Irish Mobile system. Is the formatting affecting things?
In reply to Jon Bolton

Re: Clickatell SMS Block

by Phillip Franks -
Jon,

If you get the failed users message the no mail was sent. I believe there's only 2 possibilities here:

- There was an error sending the mail. (are mails working elsewhere in Moodle?)

- The number validator is returning false. However, this method shouldn't be blocking non-irish numbers - if it can't match the number, it should do nothing. As a test, you can replace the function with this:
function sms_validate_number($number) {
 return $number;
}
In reply to Phillip Franks

Re: Clickatell SMS Block

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers

Thanks for your response (and patience!) Philip.

Emails are definitely being sent out from my Moodle from Forums and the like. I can't check the other function as I'm out of the office all day but I'll try it tonight.

In the meantime, have a good Christmas. Uh, one has to be careful about saying that in today's politically correct climate, so...

Please accept with no obligation, implied or implicit, my best wishes for an environmentally conscious, socially responsible, low stress, non-addictive, gender neutral celebration of the winter solstice holiday, practiced within the most enjoyable traditions of the religious persuasion of your choice, or the secular practices of your choice, with respect for the religious or secular persuasions and/or traditions of others, or their choice not to practice religious or secular traditions at all.

May you have a fiscally successful, personally fulfilling and medically uncomplicated recognition of the onset of the generally accepted calendar year 2007, but not without due respect for the calendars of choice of other cultures whose contributions to society have helped to make the UK great (not to imply that the UK is necessarily greater than any other country) and without regard to the race, creed, colour, age, physical ability, religious faith, political belief, choice of computer platform or sexual preference of the wishee.

big grin

In reply to Jon Bolton

Re: Clickatell SMS Block

by Paul Andrews -
Hello!

Is there an update planned for 1.7?

Teachers can't send SMS y'see due to the new roles system.

clown
In reply to Paul Andrews

Re: Clickatell SMS Block

by Phillip Franks -

Hi Paul,

Unfortunately no, we're not planning any updates for 1.7 in the near future as we will be sticking to Moodle 1.6 for this academic year.

Phil
In reply to Phillip Franks

Re: Clickatell SMS Block

by Colin Heron -
Hi Phil.
I am getting a similar response to the one reported earlier:

SMS failed for the following user(s):
Colin Heron (Phone: 07919******)

I've proved the clickatell account by sending the message through a browser address line and I have made the changes suggested to the number validation code.

Any other ideas what this could be?

Any help would be much appreciated.

PS I am using version 2 (HTTP) but had the same problem with version one (email to sms)


In reply to Colin Heron

Re: Clickatell SMS Block

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers

I had problems with the HTML Editor not appearing, caused by the mod_security module of Apache being over-zealous. When I fixed that, the SMS block started working for me thoughtful.  The following page explains some of the background: http://www.urbangiraffe.com/2005/08/20/mysterious-406-error/

So, try the following...

  1. if there is not one already, create a file called ".htaccess" file
  2. add the following lines to disable mod_security:

<IfModule mod_security.c>
/mod_security.c>
  SecFilterEngine Off
  SecFilterScanPOST Off
</IfModule>

If that solves the problem, then I would stringly advise you to contact your web host and get them to tweak and tone down the security, rather than leaving the mod_security module disabled. There's more information about the mod_security module at http://www.modsecurity.org/

In reply to Jon Bolton

Re: Clickatell SMS Block

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers
Whoops, some code got garbled there! What is should have said was...

I had problems with the HTML Editor not appearing, caused by the mod_security module of Apache being over-zealous. When I fixed that, the SMS block started working for me.  The following page explains some of the background: http://www.urbangiraffe.com/2005/08/20/mysterious-406-error/

So, try the following...

1. if there is not one already, create a file called ".htaccess"
2. add the following lines to disable mod_security:

<IfModule mod_security.c>
  SecFilterEngine Off
  SecFilterScanPOST Off
</IfModule>

If that solves the problem, then I would strongly suggest you contact your web host and get them to tweak and tone down the settings for the mod_security module, rather than leaving it disabled. There's more information about the mod_security module at http://www.modsecurity.org.
In reply to Phillip Franks

Re: Clickatell SMS Block

by Dale Davies -
I'm considering the Clickatell SMS service for use with Moodle. Is this plugin compatible with Moodle v1.9+?

Many thanks,
Dale.
In reply to Dale Davies

Re: Clickatell SMS Block

by song yuan lim -
it can used in moodle1.9+. Try to modify the code in index.php at line 31. try to disable the else if function. After that, u can use this Block for any roles.
In reply to Phillip Franks

Re: Clickatell SMS Block

by Jessica Rivera V -
Help please, I don't know where is the problem... I installed the block and created an account in clickatell, I tested the gateway directly from page and sending an email from my gmail account, it works, but when I try to send an sms from moodle, it looks like everything is going well, I am asked for confirmation to send the sms, I confirm and it shows the "SMS successfully sent to all users" message... but I don't receive any SMS in my cellphone... and I don't either see any sent mail in my gmail account (also configured as SMTP server on moodle), I can send normal mails from forums and courses and confirmations for new users... the only problem is SMS's... any idea?