customerio / customerio-ruby

A ruby client for the Customer.io event API.
https://customer.io/docs/api/
MIT License
64 stars 75 forks source link

Add trigger broadcast method DEV-733 #100

Open jeremygottfried opened 1 year ago

jeremygottfried commented 1 year ago

At MLH, we extended the customerio-ruby gem to add a method for the trigger broadcast API, aka /v1/campaigns/#{broadcast_id}/triggers

This feature has been very helpful for us, and we'd love to contribute to the base gem so everyone can use it.

Here's an example demonstrating how our code works:

require "customerio"

client = Customerio::APIClient.new("your API key", region: Customerio::Regions::US)

payload = {
  emails: [
    "recipient1@example.com",
    "anotherRecipient@example.com"
  ],
  data: {
    headline: "Roadrunner spotted in Albuquerque!",
    date: 1511315635,
    text: "We received reports of a roadrunner in your immediate area! Head to your dashboard to view more information!"
  },
  email_add_duplicates: false,
  email_ignore_missing: false,
  id_ignore_missing: false
}

request = Customerio::TriggerBroadcastRequest.new(
  broadcast_id: 12345,
  payload: payload
)

begin
  response = client.trigger_broadcast(request)
  puts response
rescue Customerio::InvalidResponse => e
  puts e.code, e.message
end
skatkov commented 11 months ago

It would be great to merge this PR and release. We're using this code on production as well, but we had to depend on our fork for this.

Is there anything we can help with here to get this merged?

theycallmeswift commented 7 months ago

Maybe @richdawe-cio can help? It seems like he's been actively maintaining the gem recently

richdawe-cio commented 7 months ago

Thanks for opening this PR, and providing this feature to other folks.

I'm just going to close and re-open it, so the latest version of the GitHub Actions are run on the PR.

@theycallmeswift I'm going to talk with people internally to see if we can integrate this into the client library.

theycallmeswift commented 6 months ago

@richdawe-cio any update on this?