Sending SMS Messages From Your Rails Application Usng Clickatell GEM

Hi Group,

I have just read and attempted to implement Luke Redpath's example:

Unfortunately, I can't get it to work.

I signed up for a Clickatell Account.

I installed the Clickatell GEM.

The following paragraphs describe my app.

# controllers/sms.rb:
require 'clickatell'

class SMS

  def initialize(config)
    @config = config

  def create(recipient, message_text)
    api.send_message(recipient, message_text)


    def api
      @api ||= Clickatell::API.authenticate(


# config/clickatell.yml:
api_key: 9999999
username: abcdefg
password: hijklmno

# config/environments/development.rb
'config', 'clickatell.yml')))

# config/routes.rb:
ActionController::Routing::Routes.draw do |map|
  map.resource :sms

# app/views/sms/new.html.erb:
<% form_tag '/sms', :method => :post do -%>
  <label>Enter the recipients mobile number:</label>
  <%= text_field_tag "recipient" %>
  <label>Enter your message:</label>
  <%= text_area_tag "message_text" %>
  <%= submit_tag "Send SMS" %>
<% end %>

# controllers/sms_controller.rb:
class SmsController < ApplicationController
def create
  sms =
  sms.create(params[:recipient], params[:message_text])
  flash[:notice] = "Message sent succesfully!"
  redirect_to :back
rescue Clickatell::API::Error => e
  flash[:error] = "Clickatell API error: #{e.message}"
  redirect_to :back

Hopefully, just like its described in the article.

I run the app and browse to: http://localhost:3000/sms/new

I enter the mobile no.: 447899999999 (I'm in the UK).

I enter the Message and click 'Send SMS'.

The app executes without an error, but no SMS is sent. My Clickatell
credits are not decremented.

Any ideas on where I'm going wrong? Has anyone managed to get this to
work using the Clickatell GEM?

Thanks in advance.

Any help would be greatly appreciated.

Kind Regards


Hi Walter,

Are you able to successfully send an SMS using the sms command line
utility bundled with the gem? Try enabling the library debug mode - you
should then be able to see the raw HTTP requests being sent.

Hi Walter,

did you manage to solve this issue? Did anyone knows how to solve this?

I'm facing exactly the same problem without any clue ...