PolyAI’s OpenTable integration enables AI voice agent capability for both Core and Pro OpenTable
customers. The integration is handled by providing a unique identifier provided by PolyAI to the OpenTable marketplace.
Before getting started, you should have both an OpenTable and PolyAI account.
Getting started
Log in to the OpenTable for Groups dashboard .
Use the OpenTable marketplace search to find the PolyAI tile .
Click “Integrate with PolyAI” .
You will be redirected to a page within OpenTable and asked for a unique identifier.
If you are not yet a PolyAI customer, click “Contact PolyAI” and trigger a sales form.
If you do have your identifier, enter it into the “Unique identifier” text field.
PolyAI and OpenTable will enable your integration and contact you once it is ready to use.
Authorization
OpenTable uses OAuth 2.0 for secure access to its API. To get started:
Request your client_id
and client_secret
from OpenTable.
Exchange your credentials for an access token .
OpenTable provides two endpoints:
Production: https://oauth.opentable.com
QA: https://oauth-pp.opentable.com
You will POST to the following URI (Production example):
POST
https://oauth.opentable.com/api/v2/oauth/token?grant_type=client_credentials
Submitting client credentials
Credentials are passed in the Authorization
header as specified in the OAuth spec . Use the following steps to submit your client credentials:
import base64
import requests
client_id = "your_client_id"
client_secret = "your_client_secret"
# Encode the client credentials
auth_string = f " { client_id } : { client_secret } "
encoded_auth = base64.b64encode(auth_string.encode()).decode()
# Set up the request
url = "https://oauth.opentable.com/api/v2/oauth/token?grant_type=client_credentials"
headers = {
"Authorization" : f "Basic { encoded_auth } " ,
"Content-Type" : "application/x-www-form-urlencoded"
}
# Send the request
response = requests.post(url, headers = headers)
print (response.json())
Making a booking
Below is a simplified Python example referencing the make_booking
logic:
import requests
def get_access_token ( client_id , client_secret ):
auth_url = "https://oauth.opentable.com/api/v2/oauth/token?grant_type=client_credentials"
auth_string = f " { client_id } : { client_secret } "
encoded_auth = requests.utils.quote(auth_string)
headers = {
"Authorization" : f "Basic { encoded_auth } " ,
"Content-Type" : "application/x-www-form-urlencoded"
}
response = requests.post(auth_url, headers = headers)
if response.status_code == 200 :
return response.json()[ "access_token" ]
else :
raise Exception ( f "Failed to obtain token: { response.text } " )
def make_booking (
access_token , rid , first_name , last_name , phone_number , country_code = "US" , special_request = ""
):
booking_url = f "https://platform.opentable.com/inhouse/v1/booking/ { rid } /reservations"
headers = {
"Authorization" : f "Bearer { access_token } " ,
"Content-Type" : "application/json"
}
payload = {
"first_name" : first_name,
"last_name" : last_name,
"phone" : {
"number" : phone_number,
"country_code" : country_code
},
"restaurant_id" : rid,
"reservation_token" : "YOUR_RESERVATION_TOKEN_HERE" ,
"sms_notifications_opt_in" : True ,
"special_request" : special_request
}
response = requests.post(booking_url, json = payload, headers = headers)
if response.status_code == 200 :
res_data = response.json()
return f "Successfully booked table for { res_data[ 'party_size' ] } on { res_data[ 'date_time' ] } "
else :
return f "Booking failed: { response.text } "
Next steps
Error handling: In production, handle normal HTTP status codes like 401 Unauthorized
, 403 Forbidden
, and 400 Bad Request
.
Data validation: Add logic to ensure users provide all required fields (e.g., names, valid phone numbers, reservation token).
Token renewal: Monitor token expiration and re-run the OAuth flow to obtain fresh tokens.
For more advanced usage—such as seat preferences, custom error flows, or credit card holds—expand on these snippets with your own business logic.
For support, contact PolyAI at platform-support@poly-ai.com
Responses are generated using AI and may contain mistakes.