Apps Marketplace

DaySchedule apps allow developers to build custom apps to connect multiple tools to transfer appointments data using OAuth2.

You would first need to register your app on DaySchedule to obtain OAuth2 credentials (a client ID and client secret) for your app. You would then need to configure your app to request authorization from the user to create triggers, and access their appointments bookings data automatically.

Oauth flow

The OAuth2 (Open Authorization 2.0) is an authorization framework that enables third-party applications to access resources on behalf of a user without the user having to disclose their credentials (such as their username and password) to the third-party application.

The OAuth2 flow involves the following steps:

  1. The app sends a request to the Dayschedule authorization server, asking for permission to access a specific API.
  2. DaySchedule prompts the user to authenticate themselves (if they are not already authenticated) and to grant permission to the app to access the DaySchedule API.
  3. If the user grants permission, the authorization server issues an access token to the app.
  4. The app uses the access token to make requests to the DaySchedule server, which validates the token and grants or denies access to the requested API endpoints.

Step 1: Authorization

Base URL:

https://api.dayschedule.com/v1/oauth2/authorize

Example authorization request to send user to consent:

https://api.dayschedule.com/v1/oauth2/authorize?client_id={{client_id}}&redirect_uri={{redirect_uri}}&response_type=code&state=12345

Step 2: Redirect

Handle the redirect on your backend server. The DaySchedule app will redirect to given redirect_uri after successful authentication.

https://example.com/redirect?code=g0ZGZmNjVmOWI&state=12345

Step 3: Token request

Send a POST request access with your code, client_id, client_secret and code returned from previous request to get the Bearer token.

Method: POST 
URL: https://api.dayschedule.com/v1/oauth2/token

Header:

Content-Type: application/json

Request body:

{
 grant_type: authorization_code,
 code: {{code}},
 client_id : {{client_id}},
 client_secret: {{client_secret}}
}

Example response

{
      access_token: "access token",
      refresh_token:  "refresh token",
      token_type: 'Bearer',
      expires_in: 3600,
}

The access token is expires after an hour (3600ms), and you’ll need to make a refresh token request to get a new access token when expired.

Step 4: Refresh token request

The refresh token step is not immediately required. But, you need to set up your server to refresh when the token has expired.

Method: POST 
URL: https://api.dayschedule.com/v1/oauth2/token

Header:

Content-Type: application/json

Request body:

{
 grant_type: refresh_token,
 client_id : {{client_id}},
 client_secret: {{client_secret}}
 refresh_token: {{refresh_token}}
}

Example response

{
      access_token: "access token",
      refresh_token:  "refresh token",
      token_type: 'Bearer',
      expires_in: 3600,
}

Triggers

TYPE NAME DESCRIPTION
event_scheduled Event scheduled To execute when a new event, webinar or service has been scheduled
before_event Before an event To execute before 5 minutes of booking start time
event_start On event started To execute immediately at the time of booking start time
event_end On event end To execute immediately at the time of booking end time
event_canceled On event canceled To execute when a booking has been canceled

Subscribe

Create a trigger to subscribe for events.The app_name is the lowercase name of your app created on DaySchedule.

Method: POST 
URL: https://api.dayschedule.com/v1/webhook/{{app_name}}

Header:

Content-type: application/json

Request body:

{
 type: "event_scheduled",
 url: "https://example.com/hook"
}

API Response:

Store the ID returned in the response. This id can be used in next step to delete/unsubscribe for events.

{
  id: "{{trigger_id}}"
}

Unsubscribe

Delete a trigger by ID to unsubscribe for events

Method: POST 
URL: https://api.dayschedule.com/v1/webhook/{{app_name}}

Header:

Content-type: application/json

Request body:

{
  id: "{{trigger_id}}"
  delete: true
}