Sending data using webhooks
Set parameters (key-value pairs) through the webhook URL directly.
About this task
Procedure
- Add Send an Email action to the webMethods Integration canvas, and connect it to Start and Stop to create a workflow.
- Configure the Send an Email action, and fill all the fields. In
the Body field, enter {{request}}. This action makes sure that the data you
pass in the webhook URL ia fetched in the body of the email. You can also fetch individual elements
of the data by using the key name with
$request.body. For example,{{$request.body.title}} or {{$request.body.id}}.Note: webMethods Integration automatically converts all the header-keys to lowercase when the data is sent to the webhook. So, if you want to retrieve the value of a specific header-key, make sure that you enter the key name in lowercase. For example, if the actual header key is Name, enter{{$request.header.name}}to retrieve its value in the workflow, otherwise, it returns an empty response. - Click Next.
- Test the workflow.
- Click Done and Save the workflow.
- In a REST client, select the HTTP request as POST and enter the webhook URL in the given field.
- In the Authorization field, select the Type
of account you want to provide.
- If you selected the Webhook Token method, you need not select an authorization type.
- Under Headers, put Content-Type as
application/json. - In the Body field, select raw and enter the data that you want to pass in JSON format.
- After you are done, click Send. The workflow runs automatically. As a result, the recipient (specified in the Send an Email action) receives the data that is passed in the email body (in JSON format).