Description
The Webhook listener waits for messages to be pushed from an external product into 1gateway.
Prerequisites
- Make sure the machine where the 1gateway is running is reachable for the external product.
- API token to push data into 1gateway.
For each User an API token is generated. The API token is needed for some plugin configurations. Follow the steps below to access the API token.
- Choose the option "My Account" in the Account Menu
- Copy the API Code and past it wherever you will need it
Installation
Make sure you have the 1gateway zip file that includes the plugin files and valid licences information ready. This file has been provided to you with the installation files.
1 - Login
Login to 1gateway, and make sure you are in "Advanced mode". If this is the first time you log in, the default user and password are both 'admin' (without the quotes).
2 - System Maintenance
Click on the menu icon and choose the option "System maintenance"
3 - Upload file
In the System maintenance view you can either drag and drop the downloaded zip file or select it by clicking the "choose file" button.
4 - Restart
After the upload installation will be confirmed. Restart 1Gateway to ensure any locked files are updated.
Configuration
Open the main menu and click on "New plugin"
Select the plugin you want to configure. Use the Filter field if needed.
Field name | Supported values | Description |
---|
Plugin ID | Any string | String to identify the source of the messages |
To push data into 1gateway, use http POST requests to the /ws/rest/send endpoint, specifying an API token on the URL.
Method
POST
Request
http://localhost:8090/ws/rest/send?token=***&pid=webhook&type=ExternalMetric
Request parameters
Parameter | Description |
---|
token | 1gateway API token |
pid | Plugin ID defined in the plugin configuration |
type | Message type. Used in the mappers |
Body
{
"element" : "myelement",
"source" : "MyPC",
"value" : 42,
"ts" : 1522831644,
"type" : "ExternalMetric"
}
JS
The body needs to be JSON and will be parsed as one message. A mapper can be used to normalize the message.
See also