messagebird / ruby-rest-api

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

Send messages to short numbers #24

Closed amarildolucas closed 5 years ago

amarildolucas commented 5 years ago

Hi, i really like messagebird-rest ruby gem.

I want to know if it's possible to send message to short numbers. In my case these numbers do operations after receiving these messages.

For example: 45100

But i got an error, so i think because is the length of the phone number:

MessageBird::ErrorException (MessageBird::ErrorException)

Thanks.

marcelcorso commented 5 years ago

Hey Amarildo.

It should work.

Did you try to look "inside" the exception? MessageBird::ErrorException#errors is a list

like this https://github.com/messagebird/ruby-rest-api/blob/d9d0855eb97662d8f9910d406d714942e3211138/examples/message_create.rb#L36

maybe you can find the root cause. Let us know!

amarildolucas commented 5 years ago

Hi @marcelcorso thank you for the help.

This is the error that i get in the exception block:

An error occured while requesting a Message object:
  code        : 9
  description : no (correct) recipients found
  parameter   : recipient

And this is the message that i'm trying to send:

client.message_create(
  'KAMBA',
  '45100', 
  'message', 
  reference: 'reference' 
)
marcelcorso commented 5 years ago

Opa @amarildolucas. I asked some colleagues and they told me that there is a intentional restriction on sending SMS to shortcodes. First shortcodes are not globally unique: they are agreed in a country by country or even only work operators. So it's hard for messagebird to know to exactly where to send them.

Also sometimes when sending SMS to shortcodes you have implied costs. Who should pay for those costs? It's not very easy to come up with a system that would solve that in a good way.

So this is not an SDK bug so I'm closing this. If you want to know more please talk to our support people at https://support.messagebird.com/hc/en-us!