I am trying to send an sms using nexmo gem,
The code was working fine up till a couple of days ago.
def send_sms
@number = params[:number]
@nannytel = params[:phone]
nexmo = Nexmo::Client.new(
key: 'xxxxxxx',
secret: 'xxxxxxx'
)
notification = "The contact number is following #{@nannytel}"
response = nexmo.send_message(
from: "SENDERID",
to: @number,
text: notification
)
if response['messages'].first['status'] == '0'
flash[:success] = "Yayy! 🎉 We just sent you details for the nanny 😍"
redirect_to root_path
else
flash[:alert] = "Uh Oh! Something went wrong, please try entering your number again"
redirect_to root_path
end
end
Above is the method in pages controller
Please modify following code
response = nexmo.send_message(
from: "SENDERID",
to: @number,
text: notification
)
AS
response = nexmo.sms.send(
from: "SENDERID",
to: @number,
text: notification
)
above changes are needed as per documentation for version 5.0.2
OR
Use version 4.8
instead of 5.0.2
gem 'nexmo', '4.8'