Prerequisites
Before diving into webhook configuration, ensure you have completed the necessary preliminary steps outlined in our Quickstart Guide. This guide will assist you in setting up a new organization and installing the Turnkey CLI. Note: We’ll create a new API Key for testing webhooks below.Environment Setup
Begin by setting the necessary environment variables:API Key Generation
Generate a new API key using the Turnkey CLI with the following command:Ngrok Installation and Setup
Ngrok is a handy tool that allows you to expose your local server to the internet. Follow these steps to set it up:1
Download Ngrok from their website.
2
Follow the provided instructions to install Ngrok and configure your auth
token.
Local Server Setup
Open a new terminal window and set up a local server to listen for incoming webhook events:Ngrok Tunneling
In another terminal, initiate Ngrok to forward HTTP requests to your local server:Verifying Ngrok Setup
To ensure Ngrok is correctly forwarding requests, perform a test using curl:nc
is running. Terminate the nc
session by pressing CTRL+C and restart it by rerunning the nc
command.
Configuring the Webhook URL
Set your webhook URL using the Turnkey CLI with the following command:Testing Your Webhook
Assuming the previous request executed successfully it’s time to test out your webhook! In order to verify that your webhook is correctly configured and receiving data, we can simply execute the previous turnkey request command again which creates a new activity request that will be captured by your webhook. Monitor the terminal withnc
running to observe the incoming webhook data.