Webhooks support pushing real-time updates from the server to the client as those updates happen. These are useful whenever you need to know exactly when a specific event happens, allowing you to take action on those events immediately via the API.

Revel supports setting up webhooks whenever any of the following actions occur:

  • An order is completed
  • A customer record is created
  • A customer record is updated
  • A rewards card is created

Webhook Setup

Revel can be supplied with URLs that will receive a POST request whenever one of the above actions occurs. The URL must be SSL-secure (https://). For example, the below URLs could be provided to Revel to receive these notifications for each of the above actions:

  • https://www.examplerewardscompany.com/receive/revel/loyalty_orders/
  • https://www.examplerewardscompany.com/receive/revel/customer/creation/
  • https://www.examplerewardscompany.com/receive/revel/customer/update/
  • https://www.examplerewardscompany.com/receive/revel/rewards_card/creation/

If using webhooks, you can choose one or more action to send notifications for. You do not have to send notification for every action that Revel supports.

Once submitted, Revel will provide the webhook recipient with a secret key that will be included with each https request in a header named X-Revel-Signature. This lets the partner verify the validity of each request upon receipt. Also, the Revel instance will be passed in a header named X-Revel-Instance. For example:

X-Revel-Signature: XIUKGMCYQYNULKYDLQTL
X-Revel-Instance: revelcustomer

Webhook Data

The following json samples show what will be sent via webhooks to their receiving URLs.

Order Completion

Upon completion of an order using a Rewards Card, a representation of the completed order will be sent using Revel's OrderAllInOne format, which includes information for the Order, Order Items, Payments and Order History. The information about the loyalty transaction can be found under orderInfo.gift_reward_data, which is a json object sent in string format. The gift_reward_data values in the following sample contain line breaks for readability's sake.

"orderInfo": {
				"gratuity":	0.0,
				"web_order":	false,
				"has_items":	true,
				"registry_data":	null,
				"exchange_discount":	null,
				"gift_reward_data": "{\"id\":15,
																										\"reward_points\":
																														{\"points_by_items\":106,
																															\"points_by_visits\":4,
																															\"points_by_purchases\":28.35},
																															\"payment_type\":0,
																															\"total_points\":126,
																															\"uri\":\"\\/resources\\/RewardsCard\\/15\\/\",
																															\"advancedRewardsInfo\":
																																			[{\"rewardCardNumber\":\"J87YUIL9812X\",
																																					\"amountOfPurchasesUpdated\":4.5,
																																					\"visitsUpdated\":true,
																																					\"amountOfVisitsUpdated\":1,
																																					\"purchasesUpdated\":true}],
																													\"establishment\":\"\\/enterprise\\/Establishment\\/1\\/\",
																													\"total_purchases\":43.35,
																													\"current_points\":106,
																													\"address\":\"\",
																													\"customer\":\"\",
																													\"error_code\":0,
																													\"updated_by\":\"\\/enterprise\\/User\\/5\\/\",
																													\"created_by\":\"\\/enterprise\\/User\\/1\\/\",
																													\"updated_date\":\"2016-04-13T17:29:15+00:00\",
																													\"resource_uri\":\"\\/resources\\/RewardsCard\\/15\\/\",
																													\"created_date\":\"2016-04-12T22:06:48+00:00\",
																													\"total_visits\":12,
																													\"number\":\"J87YUIL9812X\"}",
				"uuid": "c3d0ad74-1737-42c3-a352-4a45449a67af",
				"created_by": "/enterprise/User/5/",
				"service_fee_untaxed": "0.000000",
				"discount_tax_amount_included":	null,
				"taxable_surcharge":	0.0,
				"taxable_surcharge_excluded":	0.0,
				"sent":	false,
				"exchanged":	null,
				"updated_by": "/enterprise/User/5/",
				"delivery_employee":	null,
				"dining_option":	0,
				"delivery_duration":	null,
				"table_owner":	null,
				"surcharge_excluded":	0.0,
				"discount_amount":	null,
				"number_of_people":	0,
				"notes": "",
				"crc":	43010,
				"bills": [],
				"pos_mode": "Q",
				"is_unpaid":	false,
				"deleted_discounts": "",
				"points_added":	0,
				"bills_info": "",
				"tax_excluded_amount":	0.36,
				"auto_grat_pct":	0.0,
				"is_discounted":	false,
				"notification_email_sent":	false,
				"delivery_distance":	null,
				"gratuity_type":	0,
				"orderhistory": [
						"/resources/OrderHistory/399/"
				],
				"closed":	true,
				"tax_country": "usa",
				"discount_code": "",
				"has_delivery_info":	false,
				"asap":	false,
				"pickup_time":	null,
				"reporting_id":	null,
				"discount_nontaxable_surcharge_included":	0.0,
				"discount":	null,
				"packages": [],
				"final_total":	4.86,
				"package": [],
				"is_invoice":	false,
				"delivery_clock_in":	null,
				"bills_type":	0,
				"discount_tax_amount":	null,
				"rounding_delta":	0.0,
				"tax_rebate":	0.0,
				"table":	null,
				"discount_reason": "",
				"notification_text_sent":	false,
				"customer_birthdate":	null,
				"vehicle":	null,
				"remaining_due":	0.0,
				"applied_taxes": [
						{
								"name": "JSL	City	Tax",
								"rounding_type":	0,
								"uuid": "7c1f2cbe-5376-47d3-b01e-aa86ff2210e3",
								"id":	21,
								"is_prevailing":	true,
								"tax_rate": "8.0000",
								"tax_table":	null,
								"local_tax_id":	31,
								"order": "/resources/Order/417/",
								"dining_options":	null,
								"resource_uri": "/resources/AppliedTaxOrder/21/"
						}
				],
				"prevailing_tax":	8.0,
				"delivery_clock_out":	null,
				"discount_rule_type":	null,
				"service_charge":	0.0,
				"customer":	null,
				"applied_service_fee": [],
				"discount_taxed":	null,
				"has_history":	true,
				"tax":	0.36,
				"bill_number":	0,
				"id":	417,
				"surcharge":	0.0,
				"points_redeemed":	0,
				"call_number":	null,
				"delivery_estimated_distance":	null,
				"bill_parent":	null,
				"establishment": "/enterprise/Establishment/1/",
				"updated_date": "2016-04-13T10:29:19",
				"prevailing_surcharge":	0.0,
				"invoice_date":	null,
				"crv_value":	0.0,
				"created_date": "2016-04-13T10:27:36",
				"call_name": "",
				"printed":	true,
				"subtotal":	4.5,
				"discounted_by":	null,
				"discount_rule_amount":	null,
				"is_readonly":	false,
				"external_sync":	null,
				"created_at": "/resources/PosStation/1/",
				"service_fee_tax": "0.000000",
				"discount_total_amount": "0.000000",
				"crv_taxed":	false,
				"local_id": "417",
				"exchanged_by": [],
				"service_fee_taxed": "0.000000",
				"resource_uri": "/resources/Order/417/"
		},
		"items": [
				{
						"gift_card_number": "",
						"is_cold":	false,
						"commissions": [],
						"price_to_display": "0.000000",
						"exchange_discount":	null,
						"parent_uuid":	null,
						"uuid": "4c8ddb69-11fa-4a78-ae1d-7cc3f1ecc674",
						"created_by": "/enterprise/User/5/",
						"service_fee_untaxed": "0.000000",
						"pure_sales":	4.5,
						"voided_by":	null,
						"sent":	false,
						"exchanged":	null,
						"updated_by": "/enterprise/User/5/",
						"start_time":	null,
						"crv_value":	0.0,
						"product_name_override": "Cheese",
						"event_date":	null,
						"discount_amount":	null,
						"tax_amount":	0.36,
						"split_parts":	1.0,
						"catering_complete":	false,
						"sales_tax_exemption_reason": "",
						"weight":	0.0,
						"sold_by_weight":	false,
						"taxed_flag":	true,
						"is_discounted":	false,
						"course_number":	0,
						"shared":	0,
						"discount_code": "",
						"deleted":	false,
						"discount":	null,
						"tax_rate":	8.0,
						"seat_number":	null,
						"package_uuid":	null,
						"cup_weight":	0.0,
						"package":	null,
						"modifier_cost": "0.0000",
						"initial_price":	4.5,
						"combo_saving_amount": "0.000000",
						"is_layaway":	false,
						"created_date": "2016-04-13T10:28:57",
						"printed":	true,
						"modifier_amount":	0.0,
						"tax_rebate":	0.0,
						"special_request": "",
						"is_donation":	false,
						"discount_reason": "",
						"temp_sort":	1460568456,
						"commission_amount": "0",
						"station": "/resources/PosStation/1/",
						"serial_number": "",
						"catering_delivery_date":	null,
						"discount_taxed":	null,
						"applied_taxes": [
								{
										"tax_amount": "0.3600",
										"name": "JSL	City	Tax",
										"rounding_type":	0,
										"uuid": "f76c27a1-c5f4-480f-963e-d0cf8f074534",
										"actual_tax_rate": "8.0000",
										"tax_rate": "8.0000",
										"tax_table":	null,
										"order_item": "/resources/OrderItem/1630/",
										"local_tax_id":	31,
										"id":	1629,
										"resource_uri": "/resources/AppliedTaxOrderItem/1629/"
								}
						],
						"is_gift":	false,
						"ervc_type":	0,
						"discount_rule_type":	null,
						"cup_qty":	0,
						"modifieritems": [],
						"split_type":	0,
						"applied_service_fee": [],
						"kitchen_completed":	null,
						"date_paid":	null,
						"cost": "0.0000",
						"uom": "",
						"tax_included":	false,
						"wholesale_saving_amount": "0.000000",
						"is_coupon":	false,
						"voided_date":	null,
						"expedited":	null,
						"id":	1630,
						"on_hold":	false,
						"ingredientitems": [],
						"bill_parent":	null,
						"service_provider":	null,
						"split_with_seat":	0,
						"updated_date": "2016-04-13T10:29:16",
						"product": "/resources/Product/5/",
						"void_ref_uuid":	null,
						"combo_used":	null,
						"dining_option":	0,
						"price":	4.5,
						"voided_reason": "",
						"combo_uuid":	null,
						"order_local_id": "417",
						"discounted_by":	null,
						"discount_rule_amount":	null,
						"service_fee_tax": "0.000000",
						"quantity":	1,
						"service_fee_taxed": "0.000000",
						"order": "/resources/Order/417/",
						"resource_uri": "/resources/OrderItem/1630/"
				}
		],
		"shell_combo_items": [],
		"payments": [
				{
						"updated_date": "2016-04-13T10:28:59",
						"executed":	false,
						"last_4_cc_digits": "",
						"processor_accepted":	false,
						"till_owner":	null,
						"id":	355,
						"payment_date": "2016-04-13T10:28:59",
						"uuid": "00f1a58f-065c-434f-a551-735acbc0ccee",
						"gratuity":	0.0,
						"tip": "0.000000",
						"created_by": "/enterprise/User/5/",
						"refund_transaction_id":	null,
						"station": "/resources/PosStation/1/",
						"cc_first_name":	null,
						"online":	false,
						"establishment": "/enterprise/Establishment/1/",
						"transaction_id": "",
						"exchanged":	null,
						"updated_by": "/enterprise/User/5/",
						"transaction_captured":	false,
						"deleted":	null,
						"refunded":	false,
						"transaction_data": "",
						"payer_id":	null,
						"processor_response":	null,
						"first_4_cc_digits":	null,
						"amount_authorized": "0.000000",
						"signature_img_url":	null,
						"change": "0.000000",
						"invoice_transition_date":	null,
						"other_payment_type":	null,
						"receipt_email":	null,
						"bill":	0,
						"rounding_delta":	0.0,
						"card_type":	null,
						"amount": "4.860000",
						"payment_type":	1,
						"created_date": "2016-04-13T10:28:59",
						"cc_last_name":	null,
						"transaction_status":	null,
						"order": "/resources/Order/417/",
						"resource_uri": "/resources/Payment/355/"
				}
		],
		"order_exchange":	null,
		"history": [
				{
						"order_closed_by": "/enterprise/User/5/",
						"opened": "2016-04-13T10:27:36",
						"order_closed_at": "/resources/PosStation/1/",
						"order_opened_by": "/enterprise/User/5/",
						"uuid": "99da53ed-638f-4e6a-bdbf-b82ab4b6a209",
						"id":	399,
						"closed": "2016-04-13T10:29:19",
						"order_opened_at": "/resources/PosStation/1/",
						"order": "/resources/Order/417/",
						"resource_uri": "/resources/OrderHistory/399/"
				}
		]
}
"orderInfo": {
				"gratuity":	0.0,
				"web_order":	false,
				"has_items":	true,
				"registry_data":	null,
				"exchange_discount":	null,
				"gift_reward_data": "{\"id\":15,
\"reward_points\":
																														{\"points_by_items\":106,
																															\"points_by_visits\":4,
																															\"points_by_purchases\":28.35},
																															\"payment_type\":0,
																															\"total_points\":126,
																															\"uri\":\"\\/resources\\/RewardsCard\\/15\\/\",
																															\"advancedRewardsInfo\":
																																			[{\"rewardCardNumber\":\"J87YUIL9812X\",
																																					\"amountOfPurchasesUpdated\":4.5,
																																					\"visitsUpdated\":true,
																																					\"amountOfVisitsUpdated\":1,
																																					\"purchasesUpdated\":true}],
																													\"establishment\":\"\\/enterprise\\/Establishment\\/1\\/\",
																													\"total_purchases\":43.35,
																													\"current_points\":106,
																													\"address\":\"\",
																													\"customer\":\"\",
																													\"error_code\":0,
																													\"updated_by\":\"\\/enterprise\\/User\\/5\\/\",
																													\"created_by\":\"\\/enterprise\\/User\\/1\\/\",
																													\"updated_date\":\"2016-04-13T17:29:15+00:00\",
																													\"resource_uri\":\"\\/resources\\/RewardsCard\\/15\\/\",
																													\"created_date\":\"2016-04-12T22:06:48+00:00\",
																													\"total_visits\":12,
																													\"number\":\"J87YUIL9812X\"}",
				"uuid": "c3d0ad74-1737-42c3-a352-4a45449a67af",
				"created_by": "/enterprise/User/5/",
				"service_fee_untaxed": "0.000000",
				"discount_tax_amount_included":	null,
				"taxable_surcharge":	0.0,
				"taxable_surcharge_excluded":	0.0,
				"sent":	false,
				"exchanged":	null,
				"updated_by": "/enterprise/User/5/",
				"delivery_employee":	null,
				"dining_option":	0,
				"delivery_duration":	null,
				"table_owner":	null,
				"surcharge_excluded":	0.0,
				"discount_amount":	null,
				"number_of_people":	0,
				"notes": "",
				"crc":	43010,
				"bills": [],
				"pos_mode": "Q",
				"is_unpaid":	false,
				"deleted_discounts": "",
				"points_added":	0,
				"bills_info": "",
				"tax_excluded_amount":	0.36,
				"auto_grat_pct":	0.0,
				"is_discounted":	false,
				"notification_email_sent":	false,
				"delivery_distance":	null,
				"gratuity_type":	0,
				"orderhistory": [
						"/resources/OrderHistory/399/"
				],
				"closed":	true,
				"tax_country": "usa",
				"discount_code": "",
				"has_delivery_info":	false,
				"asap":	false,
				"pickup_time":	null,
				"reporting_id":	null,
				"discount_nontaxable_surcharge_included":	0.0,
				"discount":	null,
				"packages": [],
				"final_total":	4.86,
				"package": [],
				"is_invoice":	false,
				"delivery_clock_in":	null,
				"bills_type":	0,
				"discount_tax_amount":	null,
				"rounding_delta":	0.0,
				"tax_rebate":	0.0,
				"table":	null,
				"discount_reason": "",
				"notification_text_sent":	false,
				"customer_birthdate":	null,
				"vehicle":	null,
				"remaining_due":	0.0,
				"applied_taxes": [
						{
								"name": "JSL	City	Tax",
								"rounding_type":	0,
								"uuid": "7c1f2cbe-5376-47d3-b01e-aa86ff2210e3",
								"id":	21,
								"is_prevailing":	true,
								"tax_rate": "8.0000",
								"tax_table":	null,
								"local_tax_id":	31,
								"order": "/resources/Order/417/",
								"dining_options":	null,
								"resource_uri": "/resources/AppliedTaxOrder/21/"
						}
				],
				"prevailing_tax":	8.0,
				"delivery_clock_out":	null,
				"discount_rule_type":	null,
				"service_charge":	0.0,
				"customer":	null,
				"applied_service_fee": [],
				"discount_taxed":	null,
				"has_history":	true,
				"tax":	0.36,
				"bill_number":	0,
				"id":	417,
				"surcharge":	0.0,
				"points_redeemed":	0,
				"call_number":	null,
				"delivery_estimated_distance":	null,
				"bill_parent":	null,
				"establishment": "/enterprise/Establishment/1/",
				"updated_date": "2016-04-13T10:29:19",
				"prevailing_surcharge":	0.0,
				"invoice_date":	null,
				"crv_value":	0.0,
				"created_date": "2016-04-13T10:27:36",
				"call_name": "",
				"printed":	true,
				"subtotal":	4.5,
				"discounted_by":	null,
				"discount_rule_amount":	null,
				"is_readonly":	false,
				"external_sync":	null,
				"created_at": "/resources/PosStation/1/",
				"service_fee_tax": "0.000000",
				"discount_total_amount": "0.000000",
				"crv_taxed":	false,
				"local_id": "417",
				"exchanged_by": [],
				"service_fee_taxed": "0.000000",
				"resource_uri": "/resources/Order/417/"
		},
		"items": [
				{
						"gift_card_number": "",
						"is_cold":	false,
						"commissions": [],
						"price_to_display": "0.000000",
						"exchange_discount":	null,
						"parent_uuid":	null,
						"uuid": "4c8ddb69-11fa-4a78-ae1d-7cc3f1ecc674",
						"created_by": "/enterprise/User/5/",
						"service_fee_untaxed": "0.000000",
						"pure_sales":	4.5,
						"voided_by":	null,
						"sent":	false,
						"exchanged":	null,
						"updated_by": "/enterprise/User/5/",
						"start_time":	null,
						"crv_value":	0.0,
						"product_name_override": "Cheese",
						"event_date":	null,
						"discount_amount":	null,
						"tax_amount":	0.36,
						"split_parts":	1.0,
						"catering_complete":	false,
						"sales_tax_exemption_reason": "",
						"weight":	0.0,
						"sold_by_weight":	false,
						"taxed_flag":	true,
						"is_discounted":	false,
						"course_number":	0,
						"shared":	0,
						"discount_code": "",
						"deleted":	false,
						"discount":	null,
						"tax_rate":	8.0,
						"seat_number":	null,
						"package_uuid":	null,
						"cup_weight":	0.0,
						"package":	null,
						"modifier_cost": "0.0000",
						"initial_price":	4.5,
						"combo_saving_amount": "0.000000",
						"is_layaway":	false,
						"created_date": "2016-04-13T10:28:57",
						"printed":	true,
						"modifier_amount":	0.0,
						"tax_rebate":	0.0,
						"special_request": "",
						"is_donation":	false,
						"discount_reason": "",
						"temp_sort":	1460568456,
						"commission_amount": "0",
						"station": "/resources/PosStation/1/",
						"serial_number": "",
						"catering_delivery_date":	null,
						"discount_taxed":	null,
						"applied_taxes": [
								{
										"tax_amount": "0.3600",
										"name": "JSL	City	Tax",
										"rounding_type":	0,
										"uuid": "f76c27a1-c5f4-480f-963e-d0cf8f074534",
										"actual_tax_rate": "8.0000",
										"tax_rate": "8.0000",
										"tax_table":	null,
										"order_item": "/resources/OrderItem/1630/",
										"local_tax_id":	31,
										"id":	1629,
										"resource_uri": "/resources/AppliedTaxOrderItem/1629/"
								}
						],
						"is_gift":	false,
						"ervc_type":	0,
						"discount_rule_type":	null,
						"cup_qty":	0,
						"modifieritems": [],
						"split_type":	0,
						"applied_service_fee": [],
						"kitchen_completed":	null,
						"date_paid":	null,
						"cost": "0.0000",
						"uom": "",
						"tax_included":	false,
						"wholesale_saving_amount": "0.000000",
						"is_coupon":	false,
						"voided_date":	null,
						"expedited":	null,
						"id":	1630,
						"on_hold":	false,
						"ingredientitems": [],
						"bill_parent":	null,
						"service_provider":	null,
						"split_with_seat":	0,
						"updated_date": "2016-04-13T10:29:16",
						"product": "/resources/Product/5/",
						"void_ref_uuid":	null,
						"combo_used":	null,
						"dining_option":	0,
						"price":	4.5,
						"voided_reason": "",
						"combo_uuid":	null,
						"order_local_id": "417",
						"discounted_by":	null,
						"discount_rule_amount":	null,
						"service_fee_tax": "0.000000",
						"quantity":	1,
						"service_fee_taxed": "0.000000",
						"order": "/resources/Order/417/",
						"resource_uri": "/resources/OrderItem/1630/"
				}
		],
		"shell_combo_items": [],
		"payments": [
				{
						"updated_date": "2016-04-13T10:28:59",
						"executed":	false,
						"last_4_cc_digits": "",
						"processor_accepted":	false,
						"till_owner":	null,
						"id":	355,
						"payment_date": "2016-04-13T10:28:59",
						"uuid": "00f1a58f-065c-434f-a551-735acbc0ccee",
						"gratuity":	0.0,
						"tip": "0.000000",
						"created_by": "/enterprise/User/5/",
						"refund_transaction_id":	null,
						"station": "/resources/PosStation/1/",
						"cc_first_name":	null,
						"online":	false,
						"establishment": "/enterprise/Establishment/1/",
						"transaction_id": "",
						"exchanged":	null,
						"updated_by": "/enterprise/User/5/",
						"transaction_captured":	false,
						"deleted":	null,
						"refunded":	false,
						"transaction_data": "",
						"payer_id":	null,
						"processor_response":	null,
						"first_4_cc_digits":	null,
						"amount_authorized": "0.000000",
						"signature_img_url":	null,
						"change": "0.000000",
						"invoice_transition_date":	null,
						"other_payment_type":	null,
						"receipt_email":	null,
						"bill":	0,
						"rounding_delta":	0.0,
						"card_type":	null,
						"amount": "4.860000",
						"payment_type":	1,
						"created_date": "2016-04-13T10:28:59",
						"cc_last_name":	null,
						"transaction_status":	null,
						"order": "/resources/Order/417/",
						"resource_uri": "/resources/Payment/355/"
				}
		],
		"order_exchange":	null,
		"history": [
				{
						"order_closed_by": "/enterprise/User/5/",
						"opened": "2016-04-13T10:27:36",
						"order_closed_at": "/resources/PosStation/1/",
						"order_opened_by": "/enterprise/User/5/",
						"uuid": "99da53ed-638f-4e6a-bdbf-b82ab4b6a209",
						"id":	399,
						"closed": "2016-04-13T10:29:19",
						"order_opened_at": "/resources/PosStation/1/",
						"order": "/resources/Order/417/",
						"resource_uri": "/resources/OrderHistory/399/"
				}
		]
}

Customer Creation or Updates

Upon completion of a customer entry being created or a customer's data being updated, the following sample is a json representation of the Customer record that will be sent via webhook.

Rewards Card Creation

Upon creation of a Rewards Card, the following is a sample json body representation will be sent to the webhook URL configured to receive Rewards Card creations.