Skip to main content

Calendly Webhooks

This guide covers how to use ngrok to integrate your localhost app with Calendly by using Webhooks. Calendly webhooks can be used to notify an external application whenever specific events occur in your Calendly account.

By integrating ngrok with Calendly, you can:

  • Develop and test Calendly webhooks locally, eliminating the time in deploying your development code to a public environment and setting it up in HTTPS.
  • Inspect and troubleshoot requests from Calendly in real-time via the inspection UI and API.
  • Modify and Replay Calendly Webhook requests with a single click and without spending time reproducing events manually in your Calendly account.
  • Secure your app with Calendly validation provided by ngrok. Invalid requests are blocked by ngrok before reaching your app.

Step 1: Start your app

For this tutorial, we'll use the sample NodeJS app available on GitHub.

To install this sample, run the following commands in a terminal:

Loading…

This will get the project installed locally.

Now you can launch the app by running the following command:

Loading…

The app runs by default on port 3000.

You can validate that the app is up and running by visiting http://localhost:3000. The application logs request headers and body in the terminal and responds with a message in the browser.

Step 2: Launch ngrok

Once your app is running successfully on localhost, let's get it on the internet securely using ngrok!

  1. If you're not an ngrok user yet, just sign up for ngrok for free.

  2. Download the ngrok agent.

  3. Go to the ngrok dashboard and copy your Authtoken.
    Tip: The ngrok agent uses the auth token to log into your account when you start a tunnel.

  4. Start ngrok by running the following command:

    Loading…
  5. ngrok will display a URL where your localhost application is exposed to the internet (copy this URL for use with Calendly). ngrok agent running

Step 3: Integrate Calendly

To register a webhook on your Calendly account follow the instructions below:

  1. Access Calendly and sign in using your Calendly account.

  2. On the My Calendly page, click Integrations on the top menu.

  3. On the All integrations page, click the API and webhooks tile and then click Get a token under the Personal access tokens section.

  4. On the Before you begin popup, click Continue, enter a name for the token in the Choose a name for this token field, click Create token, click Copy token, and then click Close. Tip: Make note of the token value.

  5. On the Your personal access tokens page, scroll down and click Copy Key in the API Key section. Tip: Make note of the key value.

  6. Open a terminal window and run the following command to gather information about your account:

    Loading…

    Note: Replace the value TOKEN in the command with the token value you copied before.

  7. The terminal logs the response of the previous command. Copy the value of the current_organization field and the uri field.

  8. In the terminal window, run the following command to register the webhook:

    Loading…

    Note: Replace the following with values copied on previous steps:

    • URL: the URL provided by the ngrok agent to expose your application to the internet (i.e. https://1a2b-3c4d-5e6f-7g8h-9i0j.ngrok.app).
    • TOKEN: the Calendly token.
    • ORGANIZATION_URL: The current_organization field you copied before.
    • USER_URL: The uri field you copied before.
    • KEY: the key you copied before.

    URL to Publish

  9. Make sure the response of the previous command contains a resource attribute with the information you provided.

Run Webhooks with Calendly and ngrok

Use your Calendly link to schedule a meeting with you. Note If you don't know your Calendly link, access Calendly, click Account on the top right corner of the page, click Share Your Link, and then copy your link.

  1. In your Calendly link, click 30 Minutes Meeting, select a date, and then click Confirm.

  2. In the Enter Details page, enter your name and email in the corresponding fields, and then click Schedule Event.

    Confirm your localhost app receives the invitee.created event notification and logs both headers and body in the terminal.

Inspecting requests

ngrok's Traffic Inspector captures all requests made through your ngrok endpoint to your localhost app. Click on any request to view detailed information about both the request and response.

info

By default, accounts only collect traffic metadata to avoid exposing secrets. You must enable full capture in the Observability section of your account settings to capture complete request and response data.

Use the traffic inspector to:

  • Validate webhook payloads and response data
  • Debug request headers, methods, and status codes
  • Troubleshoot integration issues without adding logging to your app

Replaying requests

Test your webhook handling code without triggering new events from your service using the Traffic Inspector's replay feature:

  1. Send a test webhook from your service to generate traffic in your Traffic Inspector.

  2. Select the request you want to replay in the traffic inspector.

  3. Choose your replay option:

    • Click Replay to send the exact same request again
    • Select Replay with modifications to edit the request before sending
  4. Modify the request (optional): Edit any part of the original request, such as changing field values in the request body.

  5. Send the request by clicking Replay.

Your local application will receive the replayed request and log the data to the terminal.

Secure webhook requests

The ngrok signature webhook verification feature allows ngrok to assert that requests from your Calendly webhook are the only traffic allowed to make calls to your localhost app.

Note: This ngrok feature is limited to 500 validations per month on free ngrok accounts. For unlimited, upgrade to Pro or Enterprise.

This is a quick step to add extra protection to your application.

  1. Access Calendly and sign in using your Calendly account.

  2. On the My Calendly page, click Integrations on the top menu.

  3. On the All integrations page, click the API and webhooks tile.

  4. On the Your personal access tokens page, scroll down and click Copy Key in the API Key section. Tip: This is the same value you used to register your webhook. See [Integrate Calendly] (#setup-webhook).

  5. Create a file named calendly_policy.yml, replacing {your key} with the value you have copied before:

    Loading…
  6. Restart your ngrok agent by running the command:

    Loading…
  7. Access your Calendly link, click 30 Minutes Meeting, select a date, and then click Confirm.

  8. In the Enter Details page, enter your name and email in the corresponding fields, and then click Schedule Event.

    Confirm your localhost app receives the invitee.created event notification and logs both headers and body in the terminal.