Send Scheduling Link

Retrieve and send scheduling links via an external application

You may use the following combination of APIs to retrieve and send a scheduling link, as well as display the available times for a given event.

Use GET https://api.calendly.com/event_types to get a collection of your event types. scheduling_url is the link for booking the event type and pooling_type tells you what kind of event you will be sharing.

require 'faraday'
token = '<your oauth token>'
user = "https://api.calendly.com/users/<user_uuid>"
params = { user: user }
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Bearer #{token}"
}
res = Faraday.get('https://api.calendly.com/event_types', params, headers)
if res.status == 200
event_types = JSON.parse(res.body)['collection']
scheduling_uri = event_types[0]['scheduling_uri']
pooling_type = event_types[0]['pooling_type']
end

Example response (truncated):

{
"collection": [
{
...
"uri": "http://api.calendly.com/event_types/88323028-5ef5-448b-9776-bc0c71b062a4",
"name": "15 Minute Meeting",
"scheduling_url": "https://calendly.com/acmesales",
"pooling_type": "round_robin"
...
}
]
}

Return a specific event type by name:

event_types.find { |obj| obj['name'] == 'my_event_name' }

Filter by pooling type (round_robin, collective, or null):

event_types.find { |obj| obj['pooling_type'] == 'round_robin' }

Retrieve available times for display

Using the uri from GET /event_types, get available times with GET https://api.calendly.com/event_type_available_times.

start_time and end_time are required, must be in the future, and cannot span more than 31 days. Ranges longer than 31 days require additional API calls.
require 'faraday'
params = {
event_type: event_type_uri, # chosen from previous API response
start_time: '2024-02-16T24:00:00.000000Z',
end_time: '2024-02-20T24:00:00.000000Z'
}
headers = {
'Content-Type' => 'application/json',
'Authorization' => "Bearer #{token}"
}
res = Faraday.get('http://api.calendly.com/event_type_available_times', params, headers)

Example response (truncated):

{
"collection": [
{
...
"status": "available",
"start_time": "2024-02-16T24:00:00.000000Z"
...
}
]
}