Issue with sending sms using twilio in my rails app -


i building rails application (based out of india) wherein need send sms users bookings confirmed. using trial account on twilio purpose. however, when try send sms, status shows 'pending' , don't receive sms desired destination number. reason?

i have created notification_controller 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 send sms are.'     render plain: message.status   end  end 

and made post request /notifications/notify.

update:

in case bulk sms provider service has worked rails app, feel free share related docs. thanks!

try send hash, that's twilio suggest , that's how used in app:

client = twilio::rest::client.new account_sid, auth_token  client.account.messages.create({     :from => 'twilio_number_assigned',      :to => 'my_number',      :body => 'learning send sms are.',   }) 

also can test message send request:

https://www.twilio.com/user/account/developer-tools/api-explorer/message-create

you'll fill in needed fields , you'll below request code example should use in app.

about status of message:

what in controller returning current status of message @ time of delivery, pending. need set callback used twilio notify when message sent.

https://www.twilio.com/docs/api/rest/sending-sms

statuscallback

a url twilio post when message processed. twilio post smssid smsstatus=sent or smsstatus=failed.

sending messages indian numbers

https://www.twilio.com/help/faq/sms/are-there-limitations-on-sending-sms-messages-to-indian-mobile-devices

  1. they cannot sent phone number in india’s not call registry

if you’ve been having trouble sending sms messages indian number, see if number registered on national not call registry.

if owner of phone number wishes start receiving sms messages twilio, can update dnc settings following instructions here.

please note above limitations regulations set indian government.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -