I am building a rails application (based out of India) wherein I need to send sms to users whose bookings are confirmed. I am using a trial account on Twilio for this purpose. However, when I try to send sms, the status always shows as 'pending' and I don't receive the sms to my desired destination number. What could be the reason?
I have created a notification_controller with the below code:
class NotificationController < ApplicationController
skip_before_action :verify_authenticity_token
def notify
client = Twilio::REST::Client.new 'my_account_SID', 'my_account_Token'
message = client.account.messages.create from: 'twilio_number_assigned', to: 'my_number', body: 'Learning to send SMS you are.'
render plain: message.status
end
end
and made a POST request to /notifications/notify.
UPDATE:
In case another bulk sms provider service has worked for your rails app, feel free to share the related docs. Thanks!