Webhooks

Kathryn Hamilton
Kathryn Hamilton
  • Updated

Overview: What are we talking about?

To learn more about what a webhook is, click here

Third-party integration services (like Zapier and IFTTT) are able to receive Webhooks from Gingr and can be used to integrate with any of the thousands of apps they are integrated with.  Alternatively, you can create your own web service that receives webhooks from Gingr.

This article includes:

 

 

Helpful Hints: Before you begin.

  • This functionality is offered by Gingr, but in many cases requires the help of a 3rd party web developer hired by your business. Our support and development teams are not able to provide guidance for implementing the following instructions. 

  • When you create 2nd, 3rd, etc. 'zaps' in Zapier, you will be given a new URL for each. Enter them into the Webhook URL field in Gingr (Left-hand Navigation: Admin » Custom Configurations separated by commas.


 

 

Video Tutorial: A helpful tour.

 

 

 

How to: Use Webhooks.


Activate Webhooks

To activate webhooks in your Gingr app, navigate to Left-hand Navigation: Admin » Custom Configurations and set a valid URL in the Webhook URL as well as a random Webhook Signature Key field. 

Important! The Webhook URL field can contain multiple URLs. Separate URLs with a comma (,).

 

Event Types

Once webhooks are activated in your application, a HTTP(s) request will be sent to the URL configured above when one of the following event occurs with relevant data in JSON format.

Technical Event Name Human Readable Event Name Event Description
check_in Reservation checked in This event is triggered when a reservation is checked in.
check_out Reservation checked out This event is triggered when a reservation is checked out
checking_in Reservation checking in This event is triggered when a user displays intent to check a reservation in. This can happen when a pet parent texts HERE to Gingr, or when an employee clicks on the check-in button from the dashboard.
checking_out Reservation checking out This event is triggered when a reservation is added to the shopping cart.
email_sent Email sent This event is triggered when a system generated email is sent from Gingr.
owner_created Owner created This event is triggered when a new owner record is created, either from the customer portal or the app by an employee.
owner_edited Owner edited This event is triggered when an existing owner record is updated, either from the customer portal or the app by an employee.
animal_created Animal created This event is triggered when a new animal record is created, either from the customer portal or the app by an employee.
animal_edited Animal edited This event is triggered when an existing animal record is updated, either from the customer portal or the app by an employee.
incident_created Incident created This event is triggered when a new incident is created for an animal by an employee in the app.
incident_edited Incident edited This event is triggered when an existing incident is updated for an animal by an employee in the app.
lead_created Lead created This event is triggered when a lead form is filled out by a pet parent either using the Gingr embeddable lead capture form or from the Gingr customer portal.
 
 
HMAC Signature Verification
 
Each request we send will contain a signature property. This is the output of a SHA256 HMAC function, where the message is "$webhook_type$entity_id$entity_type" (3 variables, concatenated together) and the key is the key set by you above. We recommend verifying the signature when you receive a request to verify that the request came from Gingr and was not forged by an imposter.
 
 
 
Response Codes
 
When you receive a webhook, you can let Gingr know that you were able to process the hook successfully. Use the following reponse codes:

Response Code Description Helpful Hint
200 Webhook was successfully received and processed.  Gingr will not re-attempt delivery.
403 Your application does not want this event.  Gingr will not re-attempt delivery.
Any other response code Some sort of error happened.  Gingr will retry 10 times, with increasing timeout durations between each subsequent attempt.
 
 
 
 
Event Data Structure Examples
 
Reservation events have the following structure. Please note that the check_out event type will include invoice data for the checked out reservation that is not included in the example below.
 
{
    "webhook_url": "https://borg.gingr.io/webhooks.php", //The URL Gingr is sending this request to
    "webhook_type": "check_out", //The event type that occurred
    "entity_id": "76390", //The ID of this webhook. I.e. a reservation ID
    "entity_type": "reservation", //The type of entity of this webhook. I.e. a reservation
    "signature": "91a12089c1223b700b7afd4f86b90105285bf9d58984a7d2042fc483f3e7d4f5", //The SHA256 HMAC of the {webhook_type} {entity_id} and {entity_type} fields concatenated together using the Signature Key set in System wide Settings
    "entity_data": { //The data associated with the above entity type and entity ID
        "a_id": "17812",
        "animal_id": "17812",
        "animal_name": "Bella",
        "gender": "Female",
        "fixed": "1",
        "vip": "0",
        "medicines": "",
        "allergies": null,
        "image": null,
        "species_id": "1",
        "a_notes": null,
        "grooming_notes": "<p>3/14/16 - Did not need NT. Nails are already really short.&nbsp;</p>",
        "birthday": "1430452800",
        "weight": "1",
        "pricing_rules_apply": "1",
        "o_id": "11277",
        "o_first": "Joe",
        "o_last": "Smith",
        "address_1": "626 Apple St.",
        "address_2": null,
        "city": "Winston Salem",
        "state": "North Carolina",
        "zip": "27103",
        "email": "demo@gmail.com",
        "home_phone": "(303) 555-5555",
        "cell_phone": "(303) 555-5555",
        "emergency_contact_name": "",
        "emergency_contact_phone": "",
        "o_notes": null,
        "current_balance": "0.00",
        "default_payment_method_fk": null,
        "stripe_customer_id": null,
        "vet_id": "6375",
        "vet_name": "Mary Vista",
        "vet_phone": "(303) 555-5555",
        "barcode": null,
        "r_id": "76390",
        "start_date": "1471251600",
        "end_date": "1471309200",
        "r_notes": "Please give them extra love!",
        "confirmed_stamp": "1471207352",
        "cancel_stamp": null,
        "check_in_stamp": "1471262703",
        "check_out_stamp": "1471452858",
        "wait_list_stamp": null,
        "wait_list_accepted_stamp": null,
        "location_id": "3",
        "last_email_sent": "1471452858",
        "last_sms_sent": null,
        "type_id": "1",
        "self_made": null,
        "answer_1": null,
        "answer_2": null,
        "answer_3": null,
        "created_at": "1471205155",
        "base_rate": "27.00",
        "final_rate": "27.00",
        "units_of_time": "3",
        "created_by": "vanessa  williams",
        "breed_id": "46",
        "breed_name": "Golden Retriever",
        "feeding_method": "Feed alone",
        "feeding_type": "Own Dry Food",
        "feeding_notes": "Own dry- 2 cups in am, 2 cups in pm",
        "temperment_type": null,
        "default_payment_method": null,
        "payment_amount": null,
        "type": "Daycare: Full Day",
        "capacity": "100",
        "question_1": null,
        "question_2": null,
        "question_3": null,
        "charge_by_hour": "0",
        "location_name": "Happy Wags",
        "location_city": "Boulder",
        "cancellation_reason": null,
        "cancellation_reason_id": null,
        "cancelled_by_username": null,
        "services_string": null,
        "feeding_time": "AM,PM",
        "feeding_amount": "2,2",
        "start_date_iso": "2016-08-15T08:05:03-04:00",
        "end_date_iso": "2016-08-15T21:00:00-04:00"
    }
}

 

Email events have the following structure:

 

{

    "webhook_url": "https://borg.gingr.io/webhooks.php",  //The URL Gingr is sending this request to

    "webhook_type": "email_sent", //The event type that occurred

    "entity_id": 5917,  //The ID of this webhook. I.e. a reservation ID

    "entity_type": "owner", //The type of entity of this webhook. I.e. a reservation

    "signature": "91a12089c1223b700b7afd4f86b90105285bf9d58984a7d2042fc483f3e7d4f5", //The SHA256 HMAC of the {webhook_type} {entity_id} and {entity_type} fields concatenated together using the Signature Key set in System wide Settings

    "entity_data": { //The data associated with the above entity type and entity ID

        "id": "5917",

        "first_name": "Mickey",

        "last_name": "Mouse",

        "address_1": "841 Lookout Rd",

        "address_2": null,

        "city": "Winston Salem",

        "state": "North Carolina",

        "zip": "27104",

        "email": "demo@gmail.com",

        "home_phone": "(303) 555-5555",

        "cell_phone": "(303) 555-5555",

        "emergency_contact_name": "",

        "emergency_contact_phone": "",

        "notes": null,

        "default_payment_method_fk": null,

        "home_location": "2",

        "opt_out_email": "0",

        "opt_out_sms": "0",

        "opt_out_marketing_email": "0",

        "opt_out_marketing_sms": "0",

        "opt_out_photo_sharing": "0",

        "opt_out_reminder_email": "0",

        "opt_out_reminder_sms": "0",

        "current_balance": "-2.56",

        "latitude": "35.23509",

        "longitude": "-75.1280061",

        "stripe_customer_id": null,

        "stripe_default_card": null,

        "payment_processor_id": "1",

        "key": "576bf720b3b6a",

        "barcode": null,

        "allow_online_login": "1",

        "created_at": "1361422800",

        "created_by": null,

        "kl_owner_id": "1002782-2",

        "form_token": "577fd1f2c5347"

    },

    "email_data": { //The data for the email that was sent

        "subject": "Test email subject",

        "value": "<p>Test email message</p><div style=\"line-height: 22.2222px;\"><br></div>"

    },

    "recipients": [ //The recipients of this email

        {

            "name": "Mickey Mouse",

            "email": "demo@gmail.com"

        }

    ]

Was this article helpful?

0 out of 1 found this helpful

Have more questions? Submit a request

Comments

0 comments

Article is closed for comments.