Description

The Webhook listener waits for messages to be pushed from an external product into 1Gateway via HTTP REST. 

Prerequisites

  • Make sure the machine where 1Gateway is running is reachable for the external product.
  • 1Gateway webhook user

In the left menu, go to Setup > Users > Add user

Add a user with a webhook role:

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.

Configuration


Open the main menu and click on "New plugin"

Select the plugin you want to configure. Use the Filter field if needed.

Configure the plugin


Field name

Supported values

Description

Message type 

Any stringThe default message type to use for messages received by this webhook
Product nameAny stringThe product name in the message header 
ID locationAny stringThe location of the unique id (if any) of these messages 


Send data using HTTP POST

To push data into 1Gateway, use HTTP POST requests to the /api/v3/message/send endpoint, specifying the following parameters:

Parameter

Description

typethe message type to use
endpointendpoint to set on the message
idid of the message
webhookthe name of the webhook pluign configured


 Also see the swagger documentation in the API Documentation menu selection. 



Method

POST

Request

http://localhost:8080/api/v3/message/send?type=CustomMessage&endpoint=webhook&id=1&webhook=Webhook listener

Authorization

Basic Auth with the username and password defined in 1Gateway

Body

{
	"element" : "myelement",
	"source" : "MyPC",
	"text" : "This is an alarm",
	"ts" : 1522831644,
	"type" : "ExternalAlarm",
	"ID" : 1
}
JS


To send multiple messages at once, put them into a JSON array.


Result




See also