Real-time Communication

Real-time updates are faciliated using Pusher. Please see their documentation for full details on receiving the following events.

Orders

Real-time events are used to keep customers updated with the latest order information, such as status updates or confirmation messages from the restaurant. These events would be used by a third-party ordering/customer-facing application.

Channel Name

The channel name will be: private-o-{order_id}, such as private-o-52a7289e96ba1c6209000003

Events

The following events will be used:

Order Confirmation Update

Sent when a restaurant confirms, adjusts, or rejects an order. Pusher event: order_confirmation

Property Type Description
confirmation integer A code indicating what action was taken, either 1, 2, or 3.
  • 1: The order was confirmed without any adjustments
  • 2: The order was adjusted (an order_adjustment event will contain the adjustment details)
  • 3: The order was rejected
reason string The rejection reason, if confirmation = 3 (rejected)

Order Adjustment

Sent when a restaurant adjusts an order (contains adjustment details). Pusher event: order_adjustment

Property Type Description
time integer For non-advance (ASAP) orders, this contains the adjusted time, in minutes. Example: 45, would indicate a new time of 45 minutes
order_date string For advance orders, this contains the adjusted date, in MM/DD/YYYY format
eta For advance orders, this contains the adjusted time, in H:MM AM format, like 9:45 PM
items array of strings Array of ordered item IDs (not menu item IDs, but the ID of the item in a given order) that were removed from the order by the restaurant
options array of strings Array of option names that were removed from the order by the restaurant

Order Status Updates

Sent when a restaurant updates an order status. These status updates occur after the order is confirmed, with status names like "Out for Delivery" or "Delivered." Pusher event: order_tracker

Property Type Description
time date/time string The status update timestamp
status string

The new status, like "Out for Delivery"

Real time order management must be enabled and configured for order_tracker events. Current configuration and status strings can be reviewed on the settings page - Settings | Real Time Order Management/Tablet Settings.

Detailed Provider status updates can be broadcast when the feature is enabled for the merchant. The detailed delivery provider status strings are:

event status description
Created delivery_created Courier: Delivery created
Canceled delivery_canceled Courier: Delivery canceled
Cancel Failure delivery_cancel_failed Courier: Delivery could not be canceled
Assigned courier_confirmed Courier: Delivery assigned
Heading To Pickup courier_ht_pickup Courier: Heading to pickup location
Pickup Arrival courier_pickup_arrival Courier: Arrived at pickup location
Picked Up courier_picked_up Courier: Delivery picked up
Heading To Dropoff courier_ht_dropoff Courier: Heading to dropoff location
Dropoff Arrival courier_dropoff_arrival Courier: Arrived at dropoff location
Dropped Off courier_dropped_off Courier: Delivery dropped off
Attempted Dropoff courier_attempted_dropoff Courier: Delivery dropoff attempted
Return Started delivery_return_start Courier: Return started
Return Canceled delivery_return_cancel Courier: Return canceled
Heading To Return courier_ht_return Courier: Heading to return location
Return Arrival courier_return_arrival Courier: Arrived at return location
Returned delivery_returned Courier: Delivery returned
Abandoned delivery_abandoned Courier: Delivery abandoned by provider
Other other Courier: Unknown update type

LEGACY Order Status Updates

Legacy pusher statuses are enabled only by request for clients who integrated with the system prior to the standardized version above being released.

Sent when a restaurant updates an order status. These status updates occur after the order is confirmed, with status names like "Out for Delivery" or "Delivered." Pusher event: order_tracker

Property Type Description
time date/time string The status update timestamp
status string

This event will also broadcast Delivery Provider status updates of Delivered or Canceled.

Detailed Provider status updates can be broadcast when the feature is enabled for the merchant. The detailed delivery provider status strings are:

event status description
Created delivery_created Courier: Delivery Created
Canceled Canceled Delivery Cancelled
Cancel Failure delivery_cancel_failed Courier: Delivery could not be cancelled
Assigned courier_confirmed Courier: Delivery Assigned
Heading To Pickup enroute_to_pickup Courier: Driver heading to pickup location
Pickup Arrival courier_confirmed_store_arrival Courier: Arrived at Store
Picked Up courier_picked_up Courier: Order Picked Up
Heading To Dropoff enroute_to_dropoff Courier: Driver heading to dropoff location
Dropoff Arrival courier_confirmed_guest_arrival Courier: Arrived at Consumer
Dropped Off Delivered Courier: Delivered
Attempted Dropoff delivery_attempted Delivery Attempted
Return Started delivery_return_start Courier: Delivery return started
Return Cancelled delivery_return_cancel Courier: Delivery return cancelled
Heading To Return enroute_to_return Courier: Driver heading to return location
Return Arrival courier_return_arrival Courier: Driver arrived at return location
Returned delivery_returned Courier: Delivery will be returned to sender
Abandoned delivery_abandoned Courier: Delivery abandoned by provider
Other other Courier: Unknown update type

Order Notification

Sent when a order fee or timing is changed. Pusher event: order_notification

Property Type Description
notification_id GUID string The GUID of the notification
type string The type of the notification, like "delivery_fee_changed" or "order_time_changed"
message string The notification message body

Order Update

Sent when an order has been updated with POS pricing overrides. Pusher event: order_update

Property Type Description
order_state_key UUID v4 string The state key that is associated with the POS update.

Order Cancellation

Sent when an order has been cancelled. Pusher event: order_cancellation

There is no additional data for this event.

Authorization

To access the private Pusher channels, you will need an auth token. See the Pusher client documentation for more details. Depending on the channel type, various forms of authentication can be used:

The Authorization Endpoint URL to use in Pusher is https://opendining.net/api/v1/pusher/auth. It can be called via HTTP GET or POST for client flexibility.

API Parameters - Secret Key Authorization

Property HTTP Method Type Description
key GET string The API Key of the application developer
secret GET or POST string The API Secret for the given restaurant

API Parameters - Access Token Authorization

Property HTTP Method Type Description
key GET string The API Key of the application developer
access_token GET or POST string The Access Token for a given customer/user account

Examples

JavaScript Pusher client auth with a restaurant's secret key:

var options = { authEndpoint: 'https://opendining.net/api/v1/pusher/auth?key=API_KEY&secret=API_SECRET' };
var pusher = new Pusher('app_key', options);
var restaurantChannel = pusher.subscribe('presence-r-RESTAURANT_ID');

JavaScript Pusher client auth with a user's access token:

var options = { authEndpoint: 'https://opendining.net/api/v1/pusher/auth?key=API_KEY&access_token=ACCESS_TOKEN' };
var pusher = new Pusher('app_key', options);
var restaurantChannel = pusher.subscribe('private-o-ORDER_ID');