How the OnSched API can Integrate Scheduling Into Your Chat-bot

Chatbot systems have greatly evolved the customer service space with rapid, personalized responses that can save businesses hundreds of thousands of dollars. Moving into 2019 these bots are looking for ways to break the mold with innovations in automation, as well as new integrations with other powerful software tools.

OnSched provides a complete Consumer, and Setup, REST API to build online booking right into your chatbot's responses and workflows. Capture default, generic, and personalized fields specific to each of your clients, then transition the contact point to a meeting or demo.

Connecting to the OnSched APITrack this API and booking appointments directly into your clients calendars is a lot easier than you may think. In this article I will describe and explain the most important pieces to building your first booking flow in order to make this a project that can be easily managed by any sized team.

Step 1: Create your OnSched profile

To begin using OnSched the first step is to create your company profile where you can set company-wide global settings, which are used across all profiles. These settings include lead -time prior to bookings, how far into the future Vendors may be booked, and a default service to eliminate extra steps in the booking flow. Your vendors will be able to manage these settings on their own should they choose to, otherwise they will assume the global settings that you set.

Create your OnSched profile


Step 2: Connect your vendor's calendar

In order to book meetings seamlessly into your Vendor's calendars you must first connect their calendar. To do this, add the Vendor's name and email to your OnSched account.

Connect your vendor's calendar


This will trigger a step-by- step signup wizard where your clients and their sales representatives can set their weekly availability and connect to any Google or Outlook calendar.

Step 3: Authentication

Once you have created your OnSched profile you will receive your ClientID and Secret in order to begin. Before calling the OnSched API you must get a token using OAuth2.0 authentication. An example of this is done in the following code snippet:

POST /connect/token



Step 4: Call the OnSched API

Once you have a token, add it to the header of your request in order to authenticate. Use a GET call for all locations to return a list of Vendors who can be booked. Now the Chat Operator knows which Vendor to book the meeting with. An example of this is done in the following code snippet:


Authorization=Bearer token&
Accept =application/ JSON


"object": "business",
" URL": "/consumer/v1/locations",
"hasMore": false,
"count": 4,
"total": 0,
"data": [
"object": "location",
"id": "cf880ea8-96c0-4627-8e59-cf8ebb67eb08",
"friendlyId": "",
"companyId": "657716dd-e869-4b65-97ed-31a6609e7e2c",
"name": "Vendor 1",


Within your application the Chat Operator now has a list of all Vendors that are enabled for online booking, and may select one to initiate the booking flow.

Step 5: Collect basic information and custom questions

The first step of the booking flow is to collect information about the lead such as name, email, phone number, and any additional fields your Vendor wishes to collect. In order to find the fields that your Vendor wishes to collect, call the OnSched API and use the location ID that you got when you called the locations Endpoint to return a list of any custom questions that the Vendor has created.

GET cf880ea8-96c0-4627-8e59-cf8ebb67eb08

Authorization=Bearer token&
Accept =application/json


"object": "BookingFieldList",
"total": 1,
"bookingFields": [
"object": "bookingField",
"id": "114",

"companyId": "",
"businessId": "cf880ea8-96c0-4627-8e59-cf8ebb67eb08",
"fieldName": "AppointmentCustomField1",
"fieldLabel": "Vendor custom question",
"fieldRequired": true,
"fieldLength": 255,
"fieldType": "string",
"sortKey": 0,
"leadQuestion": false,
"leadQuestionWeight": 0,
"fieldListItems": []


Once you have gathered all applicable information for the lead in order to book the appointment, you can start by creating this lead within the Vendor's profile. This step will create a customerID, which is required in order to POST the appointment. To create a customer in the Vendor's profile, call the API to POST a new customer:


Authorization=Bearer token&
Accept =application/json


"object": "customer",
"id": "54129",
"locationId": "cf880ea8-96c0-4627-8e59-cf8ebb67eb08",
"id": "",
"lastname": "Doe",
"firstname": "John",


Step 6: Book a meeting

Once you have collected all necessary information from the lead and created a customer in the Vendor's profile, it's now time to suggest some dates and times for the meeting. By calling the days endpoint on the API you can return a list of upcoming available dates and times for new leads to select from. To do this, call the API using todays date as the startDate, and a week from today as the endDate.

Be sure to read the next Chat article: Daily API RoundUp: IEX Cloud, DrugBank, AmplifyReach, FishWatch