diff --git a/examples/node-webhooks/README.md b/examples/node-webhooks/README.md index 33a383c0a..1eb75f28a 100644 --- a/examples/node-webhooks/README.md +++ b/examples/node-webhooks/README.md @@ -50,7 +50,39 @@ https://github.com/user-attachments/assets/1448b658-9e6f-4652-8300-6cebbf081f7a - Ensure the `boards:read` scope is checked. - Install the app on your developer team. You will get an **access token**, which is required later to authenticate your webhook subscription. -2. In a new terminal session, run: +2. In a new terminal window, run: + +``` +ngrok http 3000 +``` + +This will output something like this: + +``` +Forwarding https: -> http://localhost:3000 +``` + +The `https:` is your `MIRO_REDIRECT_URL` to be used in the `.env` file and then later when calling the API to create a webhook subscription. + +3. Rename the `.sample.env` file to `.env` and then add in your `MIRO_CLIENT_ID` and `MIRO_CLIENT_SECRET` from your [developers.miro.com](https://developers.miro.com/) app settings page. Use the `forwarding URL` from the previous step for the `MIRO_REDIRECT_URL` in the .env file. Save the file as `.env` with your new variables. + +4. Run `npm i` to install dependencies. + +5. Run `npm start` to start the dev server. + +6. Go to your developer team, and open the board you want to receive webhook events for. + +7. In a separate browser tab, open up the API Exporer for the [Create Webhook Subscription endpoint](https://developers.miro.com/reference/create-board-subscription). + +8. Provide the following information in the API Explorer: + +> **Access Token**: Once you get the access token after installing your app on a developer team (from step 4 above), you can add the access token to the Authorization section of the API reference page. +> +> **boardId:** Get the board ID of the board you want to receive notifications for. This board should be in the same team where you installed the app. You can find board ID in the URL when you go to your board: https://miro.com/app/board/. +> +> **callbackUrl:** This is the URL where you will receive events. It should be the same as `MIRO_REDIRECT_URL` in `.env`. 9. Select Try It! to run the API request right from the browser. If you get a 201 response, you are ready to receive events! + +10. Next, go to to the same board which you referenced in the request above, and create a sticky. You should now receive a webhook event! Great job! You've just learned how to get started with Miro's webhooks with Python 🎉. # 🗂️ Folder structure