keyword_highlighter.lua

 1-- keyword_highlighter.lua
 2-- Notifies you when incoming emails contain specific keywords.
 3-- Useful for tracking topics across your inbox.
 4
 5local matcha = require("matcha")
 6
 7local keywords = {
 8    "urgent",
 9    "deadline",
10    "invoice",
11    "payment",
12    "meeting",
13    "review",
14}
15
16matcha.on("email_received", function(email)
17    local subj = email.subject:lower()
18    for _, keyword in ipairs(keywords) do
19        if subj:find(keyword, 1, true) then
20            matcha.notify("[" .. keyword .. "] " .. email.subject, 3)
21            return
22        end
23    end
24end)