Webhooks provide a way to call scripts on your own server when certain events happen in your Snappy account. For example, you may wish to run a given script when a ticket is escalated, or when a new private note in created.
When a webhook event occurs, a JSON payload will be sent to the URL you provide via your account settings. The payload will be sent via an HTTP POST request, and your application should respond with a HTTP 200 status code, indicating that you have successfully received the payload.
In Snappy the Content-Type is application/x-www-form-urlencoded, as opposed to application/json. With this content type, the raw body itself is not JSON.
The webhook sends the data form encoded with two entries - event and data. Event is the event name, and data contains the JSON. If you want to get access to the JSON of the webhook event in PHP, you can use
$json = json_decode($_POST['data'], true);
This allows you to switch on the event type before parsing the payloads (which can be large sometimes depending on message content). To switch event types, access $_POST['event'].
If you're using Laravel, you can access the data with:
$json = json_decode($request->get('data'), true);
The contact.created webhook is fired whenever a message is sent to your Snappy account.
Returns a contact object, as well as the ticket.
The message.incoming webhook is fired whenever a message is sent to your Snappy account.
Returns a note object, as well as the ticket.
The message.outgoing webhook is fired whenever a message is sent from your Snappy account.
Returns a note object, as well as the ticket.
The message.private webhook is fired whenever a message is sent to your Snappy account.
Returns a note object, as well as the ticket.
The tags.changed webhook is fired whenever a message is sent to your Snappy account.
Returns a ticket object, as well as the added and removed tags.
The ticket.created webhook is fired whenever a new ticket is created in your Snappy account.
Returns a ticket object.
The ticket.replied webhook is fired when you respond to a ticket, or when you manually mark a ticket as replied.
Returns a ticket object.
The ticket.waiting webhook is fired on new tickets and new messages for existing tickets. This event indicates a ticket is waiting a response from you.
Returns a ticket object.
The contact object contains the following attributes:
The note object contains the following attributes:
The staff object contains the following attributes:
The ticket object contains the following attributes: