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.

1require 'faraday'
2
3token = '<your oauth token>'
4user = "https://api.calendly.com/users/<user_uuid>"
5
6params = { user: user }
7headers = {
8 'Content-Type' => 'application/json',
9 'Authorization' => "Bearer #{token}"
10}
11
12res = Faraday.get('https://api.calendly.com/event_types', params, headers)
13
14if res.status == 200
15 event_types = JSON.parse(res.body)['collection']
16 scheduling_uri = event_types[0]['scheduling_uri']
17 pooling_type = event_types[0]['pooling_type']
18end

Example response (truncated):

1{
2 "collection": [
3 {
4 ...
5 "uri": "http://api.calendly.com/event_types/88323028-5ef5-448b-9776-bc0c71b062a4",
6 "name": "15 Minute Meeting",
7 "scheduling_url": "https://calendly.com/acmesales",
8 "pooling_type": "round_robin"
9 ...
10 }
11 ]
12}

Return a specific event type by name:

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

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

1event_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.
1require 'faraday'
2
3params = {
4 event_type: event_type_uri, # chosen from previous API response
5 start_time: '2024-02-16T24:00:00.000000Z',
6 end_time: '2024-02-20T24:00:00.000000Z'
7}
8headers = {
9 'Content-Type' => 'application/json',
10 'Authorization' => "Bearer #{token}"
11}
12
13res = Faraday.get('http://api.calendly.com/event_type_available_times', params, headers)

Example response (truncated):

1{
2 "collection": [
3 {
4 ...
5 "status": "available",
6 "start_time": "2024-02-16T24:00:00.000000Z"
7 ...
8 }
9 ]
10}