Emma API Documentation

Webhooks

You can manage your webhooks with these endpoints. Of particular interest might be the GET /#account_id/webhooks/events endpoint which lets you know which events our system can send out webhooks for. You can get more info about how our webhooks work.

GET /#account_id/webhooks

Get a basic listing of all webhooks associated with an account.

Returns :A list of webhooks that belong to the given account.

Sample Response [showhide]
GET /100/webhooks

[
  {
    "url": "http://myemma.com",
    "webhook_id": 100,
    "method": "POST",
    "account_id": 100,
    "event": "mailing_finish"
  },
  {
    "url": "http://tech.myemma.com",
    "webhook_id": 101,
    "method": "POST",
    "account_id": 100,
    "event": "mailing_finish"
  }
]

GET /#account_id/webhooks/#webhook_id

Get information for a specific webhook belonging to a specific account.

Returns :Details for a single webhook
Raises :Http404 if no webhook found

Sample Response [showhide]
GET /100/webhooks/100

{
  "url": "http://myemma.com", 
  "event": "mailing_finish", 
  "method": "POST", 
  "account_id": 100, 
  "webhook_id": 100
}

GET /#account_id/webhooks/events

Get a listing of all event types that are available for webhooks.

Returns :A list of event types and descriptions

Sample Response [showhide]
GET /100/webhooks/events

[
  {
    "event_name": "mailing_finish",
    "webhook_event_id": 1,
    "description": "Fired when a mailing is finished."
  },
  {
    "event_name": "mailing_start",
    "webhook_event_id": 2,
    "description": "Fired when a mailing starts."
  },
  {
    "event_name": "member_signup",
    "webhook_event_id": 3,
    "description": "Fired when a member signs up through a signup form."
  },
  {
    "event_name": "message_open",
    "webhook_event_id": 4,
    "description": "Fired when a message is opened."
  },
  {
    "event_name": "message_click",
    "webhook_event_id": 5,
    "description": "Fired when a link in a message is clicked."
  },
  {
    "event_name": "member_optout",
    "webhook_event_id": 6,
    "description": "Fired when a member opts out."
  },
  {
    "event_name": "message_share",
    "webhook_event_id": 7,
    "description": "Fired when a member shares a message."
  },
  {
    "event_name": "message_share_click",
    "webhook_event_id": 8,
    "description": "Fired when a someone follows a link a member has shared."
  },
  {
    "event_name": "import_finish",
    "webhook_event_id": 9,
    "description": "Fired when a member import completes."
  },
  {
    "event_name": "member_update",
    "webhook_event_id": 10,
    "description": "Fired when a member is updated."
  },
  {
    "event_name": "member_delete",
    "webhook_event_id": 11,
    "description": "Fired when a member is deleted."
  },
  {
    "event_name": "member_add_to_group",
    "webhook_event_id": 12,
    "description": "Fired when a member(s) is added to a group(s)."
  },
  {
    "event_name": "member_remove_from_group",
    "webhook_event_id": 13,
    "description": "Fired when a member(s) is removed from a group(s)."
  },
  {
    "event_name": "group_create",
    "webhook_event_id": 14,
    "description": "Fired when a group is created."
  },
  {
    "event_name": "group_delete",
    "webhook_event_id": 15,
    "description": "Fired when a group is deleted."
  },
  {
    "event_name": "group_update",
    "webhook_event_id": 16,
    "description": "Fired when a group is updated."
  },
  {
    "event_name": "member_status_update",
    "webhook_event_id": 17,
    "description": "Fired when a member's status changes."
  },
  {
    "event_name": "message_forward",
    "webhook_event_id": 18,
    "description": "Fired when a message is forwarded."
  },
  {
    "event_name": "member_add",
    "webhook_event_id": 19,
    "description": "Fired when a single member is added."
  },
  {
    "event_name": "field_create",
    "webhook_event_id": 20,
    "description": "Fired when a field is created."
  },
  {
    "event_name": "field_delete",
    "webhook_event_id": 21,
    "description": "Fired when a field is deleted."
  },
  {
    "event_name": "field_update",
    "webhook_event_id": 22,
    "description": "Fired when a field is updated."
  }
]

POST /#account_id/webhooks

Create an new webhook.

If method is ‘POST’, the data will be posted to the given URL as a blob of JSON. If the method is ‘GET’ the data will be added to the query string of your URL as a url encoded blob of JSON in a key called ‘payload’.

Parameters:
  • event (string) – The name of an event to register this webhook for
  • url (string) – The URL to call when the event happens
  • method (string) – The method to use when calling the webhook. Can be GET or POST. Defaults to POST.
  • public_key – The public_key to use for authentication. Note: this can also be spelled “user_id” but this is deprecated.

Sample Response [showhide]
POST /100/webhooks
{
  "url": "http://myemma.com/blog/", 
  "event": "mailing_finish"
}

1024

PUT /#account_id/webhooks/#webhook_id

Update an existing webhook. Takes the same params as create_webhook.

Returns :The id of the updated webhook, or False if the update failed.
Raises :Http404 if the webhook cannot be found.

Sample Response [showhide]
PUT /100/webhooks/100
{
  "url": "http://tech.myemma.com/"
}

100

DELETE /#account_id/webhooks/#webhook_id

Deletes an existing webhook.

Returns :True if the webhook deleted successufully.
Raises :Http404 if no webhook found

Sample Response [showhide]
DELETE /100/webhooks/101

true

DELETE /#account_id/webhooks

Delete all webhooks registered for an account.

Returns :True if the webhooks deleted successufully.

Sample Response [showhide]
DELETE /100/webhooks

true

Related Topics

Interested in Emma?

Emma's email marketing makes communicating simple and stylish. Get started today.