Method: Mandrill::Webhooks#add

Defined in:
lib/mandrill/api.rb

#add(url, description = nil, events = []) ⇒ Hash

Add a new webhook

Parameters:

  • url (String)

    the URL to POST batches of events

  • description (String) (defaults to: nil)

    an optional description of the webhook

  • events (Array) (defaults to: [])

    an optional list of events that will be posted to the webhook

    • String

      events[] the individual event to listen for

Returns:

  • (Hash)

    the information saved about the new webhook

    • Integer

      id a unique integer indentifier for the webhook

    • String

      url The URL that the event data will be posted to

    • String

      description a description of the webhook

    • String

      auth_key the key used to requests for this webhook

    • Array

      events The message events that will be posted to the hook

      - [String] events[] the individual message event (send, hard_bounce, soft_bounce, open, click, spam, unsub, or reject)
      
    • String

      created_at the date and time that the webhook was created as a UTC string in YYYY-MM-DD HH:MM:SS format

    • String

      last_sent_at the date and time that the webhook last successfully received events as a UTC string in YYYY-MM-DD HH:MM:SS format

    • Integer

      batches_sent the number of event batches that have ever been sent to this webhook

    • Integer

      events_sent the total number of events that have ever been sent to this webhook

    • String

      last_error if we’ve ever gotten an error trying to post to this webhook, the last error that we’ve seen



1155
1156
1157
1158
# File 'lib/mandrill/api.rb', line 1155

def add(url, description=nil, events=[])
    _params = {:url => url, :description => description, :events => events}
    return @master.call 'webhooks/add', _params
end