Posting data to webMethods Integration using webhooks

Let us understand how to pass large data and use it in an action with the help of an example.

  • Add Send an Email action to the IBM webMethods Integration canvas, and connect it to Start and Stop to create a workflow.
  • Configure the Send an Email action, and fill up all the fields. In the Body field, enter {{request}}. This ensures that the data you pass in the webhook URL will be 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: IBM webMethods Integration automatically converts all the header-keys to lowercase while sending the data to the webhook. So if you wish to retrieve the value of a specific header-key, ensure 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 will return an empty response.
  • Once you have entered these details, click Next, test the workflow, click Done, and then Save this 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 have selected the User Auth method while activating the webhook, select Basic Auth type from the drop-down list and if you have selected the Auth token method while activating the webhook, 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.
  • Once you are done, click Send located on the top-right corner of the page. As soon as you click Send, the workflow will run automatically. As a result, the recipient (specified in the Send an Email action) will receive the data passed in the email body (in JSON format).