Walter Lockhart
2008-Nov-07 13:16 UTC
Sending SMS Messages From Your Rails Application Usng Clickatell GEM
Hi Group,
I have just read and attempted to implement Luke Redpath''s example:
http://www.lukeredpath.co.uk/2007/8/29/sending-sms-messages-from-your-rails-application
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
end
def create(recipient, message_text)
api.send_message(recipient, message_text)
end
private
def api
@api ||= Clickatell::API.authenticate(
@config[:api_key],
@config[:username],
@config[:password])
end
end
# config/clickatell.yml:
api_key: 9999999
username: abcdefg
password: hijklmno
# config/environments/development.rb
CLICKATELL_CONFIG = YAML.load(File.open(File.join(RAILS_ROOT,
''config'', ''clickatell.yml'')))
# config/routes.rb:
ActionController::Routing::Routes.draw do |map|
map.resource :sms
end
# 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.new(CLICKATELL_CONFIG)
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
end
end
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
Walter
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Luke Redpath
2008-Dec-29 21:16 UTC
Re: Sending SMS Messages From Your Rails Application Usng Cl
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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
David G.
2010-Nov-07 22:38 UTC
Re: Sending SMS Messages From Your Rails Application Usng Clickatell GEM
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 ... Thanks! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.