Simple pub/sub style client for the Slack Discovery API
npm i tobias
const tobias = require('tobias');
const instance = new tobias({
discoveryToken: process.env.SLACK_DISCOVERY_TOKEN,
logger: console,
pollingIntervalSec: 1
});
instance.on("message", ({ message, channelId, slackDiscoveryClient }) => {
console.log("\tChannel %s Message: %s", channelId, message.text);
if (message.text.includes('pizza')) {
slackDiscoveryClient.tombStoneMessage(
ts = message.ts,
channel = channelId,
team = message.team,
replaceWithText = 'Please refrain from discussing :pizza:');
}
});