Tutorial 10: Create a Webhook
Introduction
This tutorial is targeting
Low-Code Developers who wants to learn how intuitive interfaces for configuring webhooks working and allowing developers to easily specify the URLs to which notifications should be sent, the events that trigger these notifications, and the data format.
What you will learn
In this tutorial, you will learn how to setup and execute such a webhook.
Webhooks are a very essential concept for connecting with external systems. A webhook is a URL with a unique token, external systems can call. In PIPEFORCE, if such a webhook URL is called, it is linked to a pipeline internally, which then gets executed.
Step 1: Create the webhook pipeline
In this step, we are going to create the pipeline which will be executed whenever the webhook is called externally. To do so, follow these steps:
Login to your portal https://YOUR_NAMESPACE.pipeforce.net.
Navigate to LOW CODE → Workbench.
Select the node of the app you created in the previous tutorial.
Click the plus icon at the top of the tree.
Name your Pipeline and then click create.
A new pipeline has been created with an hello world example in it.
Replace its content by this pipeline:
pipeline:
- mail.send:
to:"you@domain.tld"
subject:"Webhook executed"
Make sure to replace you@domain.tld by your email address. Whenever the webhook is executed, an email will be send to this address.
10. Click SAVE to save the pipeline.
11. In order to test it, run the pipeline by clicking the RUN button at the top.
12. The pipeline should be successfully executed. After a few seconds, you should receive an email in your inbox with subject Webhook executed
.
13. Now add the command event.listen
 to the pipeline as shown in this listing:
pipeline:
- event.listen:
key:"webhook.tutorial"
- mail.send:
to:"you@domain.tld"
subject:"Webhook executed"
14. The command event.listen
 makes sure that this pipeline is executed whenever a webhook has been received with event key webhook.tutorial
. So, it listens only for this specific webhook.
Step 2: Create the webhook
Now you will link the external caller to your pipeline by creating a webhook configuration. To do so, you have two options:
Using the commandÂ
webhook.put
Using the Portal
In this tutorial we will use the latter one: Creating a webhook configuration using the Web Portal.
Login to your PIPEFORCE portal.
Navigate to LOW CODE → Webhooks.
Click ADD WEBHOOK. A dialog should open, similar to this:
Use these values to create a webhook configuration and click ADD afterwards:
EventKey:Â
webhook.tutorial
Payload type:Â
ignore
Max. payload length:Â
0
A new entry was created in the list of webhooks. Click on it and copy the URL for the next step.
Step 3: Execute the webhook
Copy the webhook url with the token parameter from the result of the previous step.
Open your browser or Postman, paste this url and execute it.
After a few seconds, you should receive an email in your inbox.
The webhook url is the url you can register in external systems to call your pipeline externally. Since this url calls your system, make sure that only you and the external system knows it.