How to Execute a Webhook Trigger
Overviewβ
Setting up a Webhook Trigger allows you to programmatically run the Fleet from an external service. Webhooks can be used by running a POST request against the provided webhook URL. This how to guide will walk you through the steps to execute a Webhook Trigger.
Stepsβ
For the examples below, substitute <WEBHOOK_URL>
with your own URL.
Step 1 - Executionβ
- Python
- Bash
- Node
- Install the Requests library by running
pip install requests
- Open up Python in your terminal window by typing
python
orpython3
- Run the following python code:
import requests
r = requests.post('<WEBHOOK_URL>')
r.status_code
r.json()
- Open up your terminal window and run the following command.
curl -X POST <WEBHOOK_URL> | json_p
- Install the axios library by running
npm install axios
- Open up Node in your terminal window by typing
node
- Run the following node code:
const axios = require("axios");
axios
.post("<WEBHOOK_URL>")
.then((res) => {
console.log(`statusCode: ${res.statusCode}`);
console.log(res);
})
.catch((error) => {
console.error(error);
});
Step 2 - Verificationβ
- Check to see if the Webhook Status Code is 201. If so, your Vessel or Fleet was scheduled to run successfully.
- Navigate to the Logs Tab for your Vessel or Fleet to verify that it ran correctly.
success
You've now successfully executed a Webhook Trigger.