messagebird / ruby-rest-api

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

Can not send sms messages to a group #25

Closed ChrisOdeon closed 5 years ago

ChrisOdeon commented 5 years ago

There doesn't seem to be any functionality to send an sms message to a group.

marcelcorso commented 5 years ago

Hey Chris, Thank you for the issue. I was browsing the docs https://developers.messagebird.com/docs/sms-messaging#send-a-message and there is no way on the public API to send a message to a group.

This client is just handy a wrapper over the http api so I don't think it's a nice idea to implement it here.

A better place to implement this is in a code that uses the client. You request the addresses on the group and iterate them (maybe batch them into recipient lists) and then do the POST to /messages.

I'm closing this now and if you are unsure about the solution let me know!

ChrisOdeon commented 5 years ago

The array of recipients msisdns. Note: can also contain groupIds. Required

marcelcorso commented 5 years ago

Oh nice! I missed that.

So it works already. Or you think the library should make it easier somehow?

ChrisOdeon commented 5 years ago

It doesn't seem to work, sorry maybe it's an issue with their API.

On Wed, Jan 23, 2019 at 9:17 AM marcel corso gonzalez < notifications@github.com> wrote:

Oh nice! I missed that.

So it works already. Or you think the library should make it easier somehow?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/messagebird/ruby-rest-api/issues/25#issuecomment-456727181, or mute the thread https://github.com/notifications/unsubscribe-auth/AA_XdPA3kns6NrSmEswejtkVrZ5VD3mzks5vGCiMgaJpZM4aMUGx .

marcelcorso commented 5 years ago

It should work.

Can you please send an email to support@messagebird.com?

Just link to this issue, give them your account email and the group you are trying to send to and it will be fine.

They will be happy to help you out.

On Thu, 24 Jan 2019, 10:33 ChrisOdeon <notifications@github.com wrote:

It doesn't seem to work, sorry maybe it's an issue with their API.

On Wed, Jan 23, 2019 at 9:17 AM marcel corso gonzalez < notifications@github.com> wrote:

Oh nice! I missed that.

So it works already. Or you think the library should make it easier somehow?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/messagebird/ruby-rest-api/issues/25#issuecomment-456727181 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AA_XdPA3kns6NrSmEswejtkVrZ5VD3mzks5vGCiMgaJpZM4aMUGx

.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/messagebird/ruby-rest-api/issues/25#issuecomment-457128888, or mute the thread https://github.com/notifications/unsubscribe-auth/AABMunjh4bIE5lmmzH--CfM-TEl8ied6ks5vGX3PgaJpZM4aMUGx .

ChrisOdeon commented 5 years ago

It seems as though it does work through the api but doesn't work through this sdk because it requires the parameter groupids instead of recipients.

marcelcorso commented 5 years ago

oh no.

Can you please try the "lower level" request method?

Something like

begin
  client.request(:post, "messages", {:originator => "marcel", :body => "monsters", 'groupIds' => ["a9a4bc87700c44ddb6c483bfc192b921"]})
rescue MessageBird::ErrorException => e
  e.errors.inspect
end