Webhooks

The Gympass webhooks will notify you when specific events are triggered. This notification is a HTTP POST request to your registered URL.

This document describes both the events that are triggered along with the data they send and the API resources available for the webhooks.

General Information

Data format

Every API resource and push event uses JSON as its standard data format.

Security

When Gympass sends an event notification to a registered webhook, we include a signature header so you know the request was sent from our servers. The header name is X-Gympass-Signature. We strongly recommend that you verify this signature when you receive a request at your webhook endpoint.

To validate the webhook signature, you must encode the request body using an HMAC-SHA-1 library in your coding language of choice. When you do this, use the secret key that was previously registered at Gympass system along with the webhook endpoint. Compare the string with the header value. If they match, the message came from our servers

Retry

The response time is 1s. After that, if we have no response, we retry for 3 times imediatelly after the missed response.

Booking Events

POST - booking.Requested

localhost:8080/gym-webhook-url/booking/requested

Triggered whenever a new booking request is made.

Request example
1curl --location --request POST 'localhost:8080/gym-webhook-url/booking/requested' \
2--header 'Content-Type: application/json' \
3--header 'X-Gympass-Signature: 0xfbdb1d1b18aa6c08324b7d64b71fb76370690e1d' \
4--data-raw '{
5 "event_type": "booking-requested",
6 "event_data": {
7 "user": {
8 "unique_token": "123456789012",
9 "name": "teste silva",
10 "email": "testesa@teste.br"
11 },
12 "slot": {
13 "id": 13,
14 "gym_id": 10,
15 "class_id": 1,
16 "booking_number": "BK_A1B2C3"
17 },
18 "timestamp": 1560983373378,
19 "event_id": "7e8cbb0f-9681-4d3e-8c36-2b3dd6ecbadb"
20 }
21}'

Request Params

NameTypeDescription
event_typeStringType of the event. For a booking request event it defaults to "booking-requested"
event_data.user.unique_tokenStringUser unique token
event_data.user.nameStringName of the user who has originated the booking request.
event_data.user.emailStringEmail of the user who has originated the booking request.
event_data.slot.idIntId for the slot.
event_data.slot.gym_idIntID for the gym in which the booking is requested to.
event_data.slot.booking_numberStringIdentifier for the booking event.
event_data._event_timeLongTime when the event was generated.
_event_idStringID for the event.

Headers

FieldDescription
Content-Typeapplication/json
X-Gympass-Signature0xfbdb1d1b18aa6c08324b7d64b71fb76370690e1d

Response

Response example
1{
2 "event_type": "booking-requested",
3 "event_data": {
4 "user": {
5 "unique_token": "123456789012",
6 "name": "teste silva",
7 "email": "testesa@teste.br"
8 },
9 "slot": {
10 "id": 13,
11 "gym_id": 10,
12 "class_id": 1,
13 "booking_number": "BK_A1B2C3"
14 },
15 "timestamp": 1560983373378,
16 "event_id": "7e8cbb0f-9681-4d3e-8c36-2b3dd6ecbadb"
17 }
18}

POST - booking.Cancelation

localhost:8080/gym-webhook-url/booking/cancelation

Triggered whenever a user cancels a previous booked class.

Request Example
1curl --location --request POST 'localhost:8080/gym-webhook-url/booking/cancelation' \
2--header 'Content-Type: application/json' \
3--header 'X-Gympass-Signature: 0xfbdb1d1b18aa6c08324b7d64b71fb76370690e1d' \
4--data-raw '{
5 "event_type": "booking-canceled",
6 "event_data": {
7 "user": {
8 "unique_token": "123456789012"
9 },
10 "slot": {
11 "id": 13,
12 "gym_id": 10,
13 "class_id": 1,
14 "booking_number": "BK_A1B2C3"
15 },
16 "timestamp": 1560983373378,
17 "event_id": "7e8cab0f-9981-4d3e-8c36-2b3dd6ecbadb"
18 }
19}'

Event payload:

NameTypeDescription
event_typeStringType of the event. For a booking cancelation event it defaults to "booking-canceled"
event_data.user.unique_tokenStringUser unique token
event_data.slot.idIntId for the slot.
event_data.slot.gym_idIntID for the gym which the booking is requested to.
event_data.slot.booking_numberStringIdentifier for the booking event.
_event_id StringIDfor the event.

Headers

FieldDescription
Content-Typeapplication/json
X-Gympass-Signature0xfbdb1d1b18aa6c08324b7d64b71fb76370690e1d

Response

Response example
1{
2 "event_type": "booking-canceled",
3 "event_data": {
4 "user": {
5 "unique_token": "123456789012"
6 },
7 "slot": {
8 "id": 13,
9 "gym_id": 10,
10 "class_id": 1,
11 "booking_number": "BK_A1B2C3"
12 },
13 "timestamp": 1560983373378,
14 "event_id": "7e8cab0f-9981-4d3e-8c36-2b3dd6ecbadb"
15 }
16}

POST - booking.LateCancelation

localhost:8080/gym-webhook-url/booking/lateCancelation

Triggered whenever a user cancels a previous booked class.

Request example
1curl --location --request POST 'localhost:8080/gym-webhook-url/booking/lateCancelation' \
2--header 'Content-Type: application/json' \
3--header 'X-Gympass-Signature: 0xfbdb1d1b18aa6c08324b7d64b71fb76370690e1d' \
4--data-raw '{
5 "event_type": "booking-late-canceled",
6 "event_data": {
7 "user": {
8 "unique_token": "123456789012"
9 },
10 "slot": {
11 "id": 13,
12 "gym_id": 10,
13 "class_id": 1,
14 "booking_number": "BK_A1B2C3"
15 },
16 "timestamp": 1560983373378,
17 "event_id": "7e8cab0f-9981-4d3e-8c36-2b3dd6ecbadb"
18 }
19}'

Event payload:

NameTypeDescription
event_typeStringType of the event. For a booking cancelation event it defaults to "booking-late-canceled"
event_data.user.unique_tokenStringUser unique token
event_data.slot.idIntId for the slot.
event_data.slot.gym_idIntID for the gym which the booking is requested to.
event_data.slot.booking_numberStringIdentifier for the booking event.
_event_idStringID for the event.

Headers

FieldDescription
Content-Typeapplication/json
X-Gympass-Signature0xfbdb1d1b18aa6c08324b7d64b71fb76370690e1d

Response

Response example
1{
2 "event_type": "booking-late-canceled",
3 "event_data": {
4 "user": {
5 "unique_token": "123456789012"
6 },
7 "slot": {
8 "id": 13,
9 "gym_id": 10,
10 "class_id": 1,
11 "booking_number": "BK_A1B2C3"
12 },
13 "timestamp": 1560983373378,
14 "event_id": "7e8cab0f-9981-4d3e-8c36-2b3dd6ecbadb"
15 }
16}

Check-in Events

POST - checkin

https://your-webhook-url-here.com

The checkin event triggers a POST request to your registered URL. Below you will find the description for the data payload that is sent on every request.

Request example
1curl --location --request POST 'https://your-webhook-url-here.com' \
2--header 'Content-Type: application/json' \
3--header 'X-Gympass-Signature: 0xfbdb1d1b18aa6c08324b7d64b71fb76370690e1d' \
4--data-raw '{
5 "event_type": "checkin",
6 "event_data": {
7 "user": {
8 "unique_token": "tesrewjksajskj"
9 },
10 "coordinates": {
11 "lat": 40.689060,
12 "long": -74.044636
13 },
14 "gym": {
15 "id": 10,
16 "title": "Academy Name",
17 "product": {
18 "description": "Test description",
19 "id": 1
20 }
21 },
22 "timestamp": "1560983373378"
23 }
24}'
NameTypeDescription
event_typeStringA description of the event that was triggered. For the checkin event
event_dataObjectContains the data sent by the event.
event_data.userObjectContains all the data for the user who has triggered the checkin
event_data.user.unique_tokenStringA unique ID to the user
event_data.coordinatesObjectContains the lat and long information for the gym where the checkin is being made.
event_data.coordinates.latDoubleLatitude for the gym where the chackin has taken place.
event_data.coordinates.longDoubleLongitude for the gym where the checkin has taken place.
event_data.gym.idIntThe gym ID for which the checkin refers.
event_data.gym.titleStringThe gym name for which the checkin refers.
event_data.productObjectProduct details for which the checkin refers
event_data.product.descriptionStringProduct description
event_data.product.idIntProduct code number
Zpass_type_number.timestampLongTimestamp for the creation date of the event

Headers

FieldDescription
Content-Typeapplication/json
X-Gympass-Signature0xfbdb1d1b18aa6c08324b7d64b71fb76370690e1d

Response

Response example
1{
2 "event_type": "checkin",
3 "event_data": {
4 "user": {
5 "unique_token": "tesrewjksajskj"
6 },
7 "coordinates": {
8 "lat": 40.689060,
9 "long": -74.044636
10 },
11 "gym": {
12 "id": 10,
13 "title": "Academy Name",
14 "product": {
15 "description": "Test description",
16 "id": 1
17 }
18 },
19 "timestamp": "1560983373378"
20 }
21}