Skip to main content

Webhook Integration Guide (Golang + Gin)

This page provides a reference for implementing a webhook endpoint in Go using the Gin framework.

Webhook Requirements

  • Accepts POST requests
  • Expects a JSON body with a flexible structure depending on the event
  • Must return an immediate 200 OK response
  • Must be served over HTTPS

The payload structure varies based on the event. Your handler should be prepared to unmarshal the specific JSON structure for each notification.

Webhook Handler Example

r.POST("/webhook", func(c *gin.Context) {
var payload Response
if err := c.ShouldBindJSON(&payload); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid JSON"})
return
}

// Handle order or product data
c.Status(http.StatusOK)
})

Webhook Event List and Payloads

1. Flight Delay Status

When a flight tied to an existing order is delayed, we send a detailed JSON payload containing full order and delay data to allow for immediate customer notification.

Sample Payload
{
"orderId": "aBvH52dg",
"orderItems": [
{
"flightNumber": "BA998",
"variantId": "DPV-000000001",
"paxType": "child",
"firstName": "John",
"lastName": "Doe",
"date": "2025-04-20",
"email": "john.doe@example.com",
"currency": "EUR",
"agencyId": "",
"id": "FJfzdcbZ",
"refundLatestDate": "2025-04-19T18:40:00Z",
"couponCode": "DETTN3SOFQMAN",
"status": "not_used",
"airport": {
"iata": "LHR",
"timezone": "Europe/London",
"city": {
"iata": "LON",
"title": "London",
"titleLocalized": {
"EN": "London",
"DE": "London",
"RU": "Лондон",
"TR": "Londra"
},
"country": {
"id": "GB",
"title": "United Kingdom"
}
},
"title": "Heathrow",
"terminals": [
{ "id": "a0c59b33-b4e3-48c3-bb71-ac2f427aef13", "title": "Terminal 5" },
{ "id": "da5988a1-688c-4d52-80fd-2acdcfb52b68", "title": "Terminal 4" }
],
"location": { "latitude": 51.469604, "longitude": -0.453566 }
},
"product": {
"airline": { "code": "BA", "name": "British Airways" },
"arrivalAirport": {
"iata": "BER",
"title": "Berlin Brandenburg Airport",
"city": { "iata": "BER", "title": "Berlin" },
"country": { "id": "DE", "title": "Germany" },
"location": { "latitude": 52.366667, "longitude": 13.503333 },
"timezone": "Europe/Berlin",
"timezone_offset": "02:00"
},
"arrivalTerminal": { "id": "7f9bdbee-b5be-4892-8950-e260e6f7ed41", "title": "Terminal 1" },
"arrivalTime": "2025-04-20T20:35:00Z",
"category": "delay-care",
"departureAirport": {
"iata": "LHR",
"title": "Heathrow",
"city": { "iata": "LON", "title": "London" },
"country": { "id": "GB", "title": "United Kingdom" },
"location": { "latitude": 51.469604, "longitude": -0.453566 },
"timezone": "Europe/London",
"timezone_offset": "01:00"
},
"departureTerminal": { "id": "a0c59b33-b4e3-48c3-bb71-ac2f427aef13", "title": "Terminal 5" },
"departureTime": "2025-04-20T18:40:00Z",
"duration": { "hours": 2, "minutes": 55 },
"flightNumber": "BA998",
"hasDifferentTerminal": false,
"id": "P-000000002",
"status": "Delayed",
"terminal": { "id": "", "title": "" }
},
"productVariant": {
"id": "DPV-000000001",
"dataHash": "5e699a88791673d03cf4a4b5118fdae128f7922c49fdf5cf780c3bca87546df4",
"refund": { "type": "day", "value": 1 },
"adultPrice": {
"baseCurrency": "USD",
"paxType": "adult",
"grossPrice": 62.3,
"netPrice": 56.1,
"currencies": [
{ "currency": "EUR", "rate": 0.873466, "grossPrice": 55 },
{ "currency": "GBP", "rate": 0.751121, "grossPrice": 46.79 },
{ "currency": "AED", "rate": 3.673, "grossPrice": 228.83 }
]
},
"childPrice": {
"baseCurrency": "USD",
"paxType": "child",
"grossPrice": 62.3,
"netPrice": 56.1,
"currencies": [
{ "currency": "EUR", "rate": 0.873466, "grossPrice": 55 },
{ "currency": "GBP", "rate": 0.751121, "grossPrice": 46.79 },
{ "currency": "AED", "rate": 3.673, "grossPrice": 228.83 }
]
}
},
"supplierName": "SupplierName",
"statusUpdatedAt": "2025-04-16T06:17:08Z",
"isRefundable": false
}
],
"email": "customer@example.com"
}

2. Product Added

Sent immediately after a new travel product or package is successfully created in our system, allowing you to update your product catalog or pricing caches.

Sample Payload
{
"eventType": "product_added",
"details": {
"id": "P-000000001",
"category": "lounge",
"terminal": {
"id": "10ad460c-273d-4a52-8780-983e4413a58c",
"title": "Terminal 1"
},
"title": "Plaza Premium Lounge",
"titleLocalized": { "EN": "Plaza Premium Lounge" },
"description": "<p>The iGA Lounge is a unique space where you can enjoy a range of amenities prior to your flight.</p>",
"descriptionLocalized": {
"EN": "<p>The iGA Lounge is a unique space...</p>",
"DE": "Die iGA Lounge ist ein einzigartiger Ort...",
"RU": "iGA Lounge — это уникальное пространство...",
"TR": "iGA Lounge, uçuşunuzdan önce..."
},
"howToUse": "",
"howToUseLocalized": { "EN": "" },
"timezone": "Asia/Hong_Kong",
"photos": [
"https://cdn-api.easyto.travel/test/ca43e2f2-bfaf-4182-b441-d98358386eec_AeroBar(1).jpg",
"https://cdn-api.easyto.travel/test/4092bc31-5c2d-453f-893a-ba2d18a70544_AeroBar(2).jpg"
],
"workingTime": [
{ "day": "monday", "open": "00:00", "close": "01:00" },
{ "day": "monday", "open": "06:00", "close": "23:59" },
{ "day": "tuesday", "open": "00:00", "close": "01:00" },
{ "day": "tuesday", "open": "06:00", "close": "23:59" }
],
"unavailablePeriods": [],
"restrictions": [
{
"type": "Airline",
"value": { "id": "ZV", "title": "ZAGROS AIRLINES" },
"description": "Airline restriction description"
}
],
"features": [
{
"id": "e7cf79c7-1e42-43d3-a6bb-1482072be521",
"payable": false,
"title": "Charging Station",
"titleLocalized": {
"EN": "Charging Station",
"DE": "Ladestation",
"RU": "Место для зарядки телефона",
"TR": "Şarj İstasyonu"
}
},
{
"id": "f23620fd-bb3f-4e28-a60b-0b5c95a92124",
"payable": false,
"title": "Flight Monitor",
"titleLocalized": {
"EN": "Flight Monitor",
"DE": "Aktuelle Fluginformationen",
"RU": "Табло вылета",
"TR": "Uçuş Monitörü"
}
}
],
"terminalType": ["departure"],
"address": "Located in Terminal 1 after security check, Level 7, Departures Level, near Gate 60",
"gateType": ["international"],
"availableAt": ""
}
}

3. Product Updated

Sent whenever key product details change (e.g., price, availability, or description). The payload includes the full new product object and a changes array detailing the specific fields that were modified.

Sample Payload
{
"eventType": "product_updated",
"changes": [
"terminal changed to Terminal 1",
"terminal type changed to [departure]",
"address changed to Located in Terminal 1 after security check, Level 7, Departures Level, near Gate 60"
],
"details": {
"id": "P-000000001",
"category": "lounge",
"terminal": {
"id": "10ad460c-273d-4a52-8780-983e4413a58c",
"title": "Terminal 1"
},
"title": "Premium Plaza Lounge",
"titleLocalized": { "EN": "Premium Plaza Lounge" },
"description": "The iGA Lounge is a unique space where you can enjoy a range of amenities prior to your flight.",
"descriptionLocalized": {
"EN": "The iGA Lounge is a unique space...",
"DE": "Die iGA Lounge ist ein einzigartiger Ort...",
"RU": "iGA Lounge — это уникальное пространство...",
"TR": "iGA Lounge, uçuşunuzdan önce..."
},
"howToUse": "",
"howToUseLocalized": { "EN": "" },
"timezone": "Asia/Hong_Kong",
"photos": [
"https://cdn-api.easyto.travel/test/ca43e2f2-bfaf-4182-b441-d98358386eec_AeroBar(1).jpg"
],
"workingTime": [
{ "day": "monday", "open": "00:00", "close": "01:00" },
{ "day": "monday", "open": "06:00", "close": "23:59" }
],
"terminalType": ["departure"],
"address": "Located in Terminal 1 after security check, Level 7, Departures Level, near Gate 60",
"gateType": ["international"],
"availableAt": ""
}
}

4. Product Removed

Notifies your system when a product is permanently removed from sale and should be retired from all active listings.

Sample Payload
{
"eventType": "product_removed",
"details": {
"id": "P-000000001",
"category": "lounge",
"airport": {
"iata": "HKG",
"timezone": "Asia/Hong_Kong",
"timezone_offset": "8:00",
"city": {
"iata": "HKG",
"title": "Hong Kong",
"country": { "id": "HK", "title": "Hong Kong" }
},
"country": { "id": "HK", "title": "Hong Kong" },
"title": "Hong Kong International",
"location": { "latitude": 22.315248, "longitude": 113.93649 }
},
"terminal": {
"id": "10ad460c-273d-4a52-8780-983e4413a58c",
"title": "Terminal 1"
},
"title": "Plaza Premium Lounge",
"description": "<p>The iGA Lounge is a unique space...</p>",
"howToUse": "",
"timezone": "Asia/Hong_Kong",
"workingTime": null,
"unavailablePeriods": null,
"restrictions": null,
"features": null,
"terminalType": ["departure"],
"address": "Located in Terminal 1 after security check, Level 7, Departures Level, near Gate 60",
"info": {},
"gateType": ["international"],
"variants": null,
"availableAt": ""
}
}