Block by Keyword
What it does: Checks the event title and description against a list of blocked keywords and prevents any matching event from syncing.
Use case: Enforce company policies by blocking confidential meeting names, filter out recurring noise events, or keep sensitive topics private.
function gate(event: GateEvent): GateResult {
const blockedKeywords = ['confidential', 'private', 'secret', 'internal'];
if (blockedKeywords.some((keyword) => event.matches(keyword))) {
return { pass: false, reason: 'Event blocked by keyword filter' };
}
return { pass: true };
}
How It Works
An array of blocked keywords is defined at the top of the function. Array.some() tests each keyword against event.matches(), which does a case-insensitive search across the event title and description. If any keyword matches, the event is blocked. Otherwise it passes through.
Customization
Adapt the keyword list to your use case:
function gate(event: GateEvent): GateResult {
const blockedKeywords = ['1:1', 'skip-level', 'performance review', 'PIP'];
if (blockedKeywords.some((keyword) => event.matches(keyword))) {
return { pass: false, reason: 'Blocked sensitive HR meeting' };
}
return { pass: true };
}
Flip to an allowlist (only pass events matching approved keywords):
function gate(event: GateEvent): GateResult {
const allowedKeywords = ['standup', 'planning', 'retrospective', 'review'];
if (allowedKeywords.some((keyword) => event.matches(keyword))) {
return { pass: true };
}
return { pass: false, reason: 'Event not in approved keyword list' };
}
Related Recipes
- Block Personal Events -- Simpler single-keyword block pattern
- Multi-Condition Filter -- Combine keyword blocking with other conditions