A Filter worker takes non-user generated input such as events, and triggers Botnet Actions.
Type: Filter Worker
To create a filter worker you need to create it from the CLI. A sample worker payload can be down here. Once you have created the worker using the CLI, it will return an ID for you.
You need to then update/create a bot and place the filter worker at the top with the id and the type of r2-filter-worker
.
More on sending the page events can be found here.
Page events allow the host page to send events to core. These events are un-trusted events and should be treated accordingly.
The page event object looks like this:
Worker payload with Page events
{
"Name": "filterWorker",
"Description": "Filter Worker",
"Enabled": true,
"Type": "r2-filter-worker",
"Config": {
"Avatar": "default-bot"
},
"Data": {
"pageEvents": [
{
"alias": "hit-api",
"actions": [
{
"type": "baas",
"alias": "wellBaaas"
},
{
"type": "baas",
"alias": "wellBaaas1"
}
]
},
{
"alias" : "send-something",
"match" :{
"path": "$.user.name",
"value": "botty"
},
"actions" : [
{
"type": "message",
"value": "hello there, botty"
}
]
},
{
"alias": "send-something",
"actions": [
{
"type": "message",
"value": "hello there"
}
]
},
{
"alias": "trigger-flow",
"actions": [
{
"type": "flow",
"value": {
"type": "r2-avalanche-worker",
"deferRelease": true,
"id": "d2ccd1dc-3c51-4ec1-be29-bf6588602b48"
}
}
]
}
]
}
}