module Drip::Client::Webhooks

Public Instance Methods

create_webhook(post_url, include_received_email, events) click to toggle source

Public: Create a webhook.

post_url - Required. The String url that the webhook will post to. include_received_email - Optional. A Boolean specifying whether we should send a

notification whenever a subscriber receives an email.
Defaults to false.

events - Optional. An Array of which events we should send

notifications for. Eligible events can be found in the
webhooks documentation here: https://www.getdrip.com/docs/webhooks#events.
By default, we will send notifications for all events except
`subscrber.received_email`.

Returns a Drip::Response See www.getdrip.com/docs/rest-api#subscriber_batches

# File lib/drip/client/webhooks.rb, line 37
def create_webhook(post_url, include_received_email, events)
  include_received_email = include_received_email ? true : false
  url = "v2/#{account_id}/webhooks"

  make_json_api_request :post, url, private_generate_resource(
    "webhooks",
    {
      "post_url" => post_url,
      "include_received_email" => include_received_email,
      "events" => events
    }
  )
end
delete_webhook(id) click to toggle source

Public: List all webhooks. id - Required. The String id of the webhook

Returns a Drip::Response. See www.getdrip.com/docs/rest-api#webhooks

# File lib/drip/client/webhooks.rb, line 56
def delete_webhook(id)
  make_json_api_request :delete, "v2/#{account_id}/webhooks/#{id}"
end
webhook(id) click to toggle source

Public: Fetch a webhook id - Required. The String id of the webhook

Returns a Drip::Response. See www.getdrip.com/docs/rest-api#webhooks

# File lib/drip/client/webhooks.rb, line 19
def webhook(id)
  make_json_api_request :get, "v2/#{account_id}/webhooks/#{id}"
end
webhooks() click to toggle source

Public: List all webhooks.

Returns a Drip::Response. See www.getdrip.com/docs/rest-api#webhooks

# File lib/drip/client/webhooks.rb, line 10
def webhooks
  make_json_api_request :get, "v2/#{account_id}/webhooks"
end