Last active
May 31, 2023 17:38
-
-
Save scottisloud/b3371ab89242f312f52091398056326c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env zsh | |
| # read bearerToken\?"What is your Calendly bearer token? " | |
| bearerToken=${1} | |
| # Get your OwnerURI | |
| rawData=$(curl -s --request GET \ | |
| --url https://api.calendly.com/users/me \ | |
| --header "Authorization: Bearer $bearerToken" \ | |
| --header 'Content-Type: application/json') | |
| ownerURI=$(echo $rawData | jq -r '.resource.uri' | cut -d '/' -f5) | |
| # Assemble request URL with your ownerURI | |
| requestURL="https://api.calendly.com/event_types?active=true&user=https%3A%2F%2Fapi.calendly.com%2Fusers%2F${ownerURI}&admin_managed=false" | |
| # Get a list of active event types and display their name and URI | |
| callData=$(curl -s --request GET \ | |
| --url $requestURL \ | |
| --header "Authorization: Bearer $bearerToken" \ | |
| --header 'Content-Type: application/json') | |
| callDataNice=$(printf '%s' $callData | jq '.collection[] | [.name, .uri]') | |
| output=$(cat << END | |
| Use this information to configure the workflow. | |
| * Select this Workflow in Alfred's Workflow settings | |
| * Select "Configure Workflow..." | |
| * Provide the workflow configuration with each of the required values: bearerToken, ownerURI, and event URIs for your personal consultation and implementation events. | |
| =================================== | |
| Your bearerToken is: | |
| $bearerToken | |
| =================================== | |
| Your ownerURI is: | |
| $ownerURI | |
| =================================== | |
| Your event names and URIs are: | |
| $callDataNice | |
| END | |
| ) | |
| echo $output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment