Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update webhook-task.md #201

Merged
merged 1 commit into from
Nov 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions docs/reference-docs/system-tasks/webhook-task.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,21 @@ You can see a sample workflow here. You may have a look at our documentation on

A webhook workflow type can be identified as ```"type": "WAIT_FOR_WEBHOOK" ```. It is a Conductor task, meaning no worker is required to run the workflow. Also, it is a type of ‘WAIT’ task, where the workflow waits for events from the external systems.

## Writing custom matchers
In above example we can see that the matchers are described as
### Writing Custom Matches​

In the above example, you can see that the matches are described as follows:

```json
"matches":
{
"$['event']['type']": "message"
}
```
which means that incoming event payload have JSON Path ```event.type``` and it must be ```message``` in order to match the webhok event with this task.
We can define any csutom json path based on incoming event payload and write matchers accordingly.
This means that the incoming event payload has JSON path ```event.type``` and it must be a ```message``` in order to match the webhook event with this task.

You can define any custom JSON path based on the incoming event payload and write matches accordingly.

We can add mulitple matchers within the matchers. All matches will be calcualted as **AND** operations withim matchers. For example,
You can also add multiple matches within the matches. All the matches will be calculated as *AND* operations within the matches.

```json
"matches":
Expand All @@ -97,15 +99,18 @@ We can add mulitple matchers within the matchers. All matches will be calcualted
}
```

will be used to match the webhook event payload where `event.type` is `message` AND `event.text` is `hello`
For example, the above one will be used to match the webhook event payload where `event.type` is `message` AND `event.text` is `hello`.

In order to match all the webhook events, the matches should be kept empty.

In order to match all the webhook event the matchers should be kept empty i.e.
```json
"matches":
{
}
```

## Creating Webhook

Now you have created your workflow. Let’s create a Webhook now.

1. Navigate to **Webhooks** from the Conductor server.
Expand Down