messagebird / ruby-rest-api

MessageBird's REST API for Ruby
BSD 2-Clause "Simplified" License
37 stars 46 forks source link

How to include country code while sending sms #7

Closed vkeziah closed 8 years ago

vkeziah commented 8 years ago

can you please let me know how to include country code while sending sms , I tried include country code but it does not work for me , see the following

@message_bird_client.message_create('FromMe', '+919440443344', 'Hello World', :reference => 'MyReference')

samwierema commented 8 years ago

Hi @vkeziah,

Where would you like to include the country code exactly? In the originator parameter, or somewhere else?

vkeziah commented 8 years ago

see my above example I included my country code +91 along with my mobile number, is it wrong ? also I tried to included country code in originator parameter, but unable to receive sms got an error

samwierema commented 8 years ago

The code, as you pasted it, should work. Are you receiving an error, and if so, which error? And, to double-check, are you using a live or a test key?

vkeziah commented 8 years ago

I am using test key, and the following is the error message I have been facing

client.message_create('Ratnakar', '+91 8008286288', 'Hello World', :reference => 'MyReference')

MessageBird::ErrorException: MessageBird::ErrorException from /home/ratnakar/.rvm/gems/ruby-2.2.2@fetchadmin/gems/messagebird-rest-1.3.1/lib/messagebird/client.rb:59:in `request'

samwierema commented 8 years ago

Ok, can you tell me what is in the MessageBird::ErrorException?

vkeziah commented 8 years ago

That is the complete error message

samwierema commented 8 years ago

Can you try this code and tell me what the output is:

begin
  client.message_create('Ratnakar', '+91 8008286288', 'Hello World', :reference => 'MyReference')
rescue MessageBird::ErrorException => ex
  puts
  puts 'An error occured while requesting a Message object:'
  puts

  ex.errors.each do |error|
    puts "  code        : #{error.code}"
    puts "  description : #{error.description}"
    puts "  parameter   : #{error.parameter}"
    puts
  end
end

Of course with all your other supporting code.

vkeziah commented 8 years ago

Now I receive no error however there is success status , but really I did not receive any sms on my mobile :(

See this MessageBird::Recipient:0x00000007810f40 @recipient=918008286288, @status="sent", @statusDatetime=2016-03-29 10:55:38 +0000

samwierema commented 8 years ago

I can confirm your request has reached our API, but I've found that the message is not sent due to a different issue. I've escalated your request to our tech support desk and will get back to you when they have an answer.

vkeziah commented 8 years ago

Ok Thanks @samwierema

samwierema commented 8 years ago

We've found that the number: +918008286288 appears on India's Do Not Disturb list. As such, it can not receive messages. This restriction, as well as other restrictions for India, can be found in our knowledge base: http://support.messagebird.com/hc/en-us/articles/203780362-India.

As the code works from a technical point-of-view, I'll close this issue for now. Please let us know if you have any further questions and/or feedback.