An incoming webhook can run a script on each article it receives.
This script gives control over a set of features:
setTitle(string)
)setText(string)
)setCategory(string)
)markAsRead()
)markAsToRead()
)sendNotification()
)triggerWebhook(string)
)disableGlobalNotification()
)The script expects a boolean value in return. This value decides the fate of the article:
return true;
: the article will be integratedreturn false;
: the article will be ignoredNote that if the article is ignored then the above features have no effect.
You are free to implement the orchestration logic of these actions with a simple syntax.
You can access the following attributes within your script:
Title
: the title of the articleText
: the text of the articleHTML
: the HTML content of the articleURL
: the URL of the articleOrigin
: the article originTags
: the tags of the article (string array)Here are some examples to illustrate the possibilities:
if ("news" in Tags) {
setCategory("News");
}
return true;
setTitle(sprintf("[From my awesome webhook] %s", Title));
return true;
if ("news" in Tags) {
setCategory("News");
if (Title ~= /breaking|important/i) {
sendNotification();
}
}
return true;
if (Title ~= /boring|stupid/i) {
return false;
}
return true;
if (Origin == "johndoe@example.com") {
setTitle(sprintf("[From %s] %s", Origin, Title));
return true;
}
return false;