We are creating a Rails application for implement the Nexmo API. In registration process, we need to send confirmation code through SMS to the user from server-side using Nexmo API. But we don't have any idea about this. We wanted to implement this feature for India only.
I have used https://github.com/dotpromo/nexmos gem and my code is:
# Gemfile
gem 'nexmos'
#sms_controller.rb:
class SmsController < ApplicationController
def new
@sms = Sms.new
end
def createclient = ::Nexmos::Message.new('#', '#')
res = client.send_text(from: '+910000000000', to: '+910000000000', text: 'Hello world!')
if res.success?
puts "ok"
else
puts "fail"
end
end
end
I have used my credentials for "key" and "Secret" in-place of "#" and replace from and to with my phone numbers. but it doesn't works. Even after not delivering the SMS to other numbers, the success block is being executed.
Can anybody guide us to implement this?.