diff --git a/apps/meteor/app/seeking-alpha/terms-of-use-violations/index.ts b/apps/meteor/app/seeking-alpha/terms-of-use-violations/index.ts index 0edd55dcf9b26..0b025a62d5f27 100644 --- a/apps/meteor/app/seeking-alpha/terms-of-use-violations/index.ts +++ b/apps/meteor/app/seeking-alpha/terms-of-use-violations/index.ts @@ -37,7 +37,7 @@ Meteor.startup(async () => { function perform() { const slack = new Slack(SLACK_TOKEN); - const keyword = 'substack'; + const keyword = TERMS_TO_MONITOR[0]; // Just search for one keyword for now. TODO: Search for all keywords const docs = aggregateMessagesContainingKeyword(keyword, yesterday()); const tsv = generateTSV(docs); sendReportToSlack(tsv, slack); @@ -145,6 +145,12 @@ function buildMongoPipelineArray(matchDoc) { // Docs: https://api.slack.com/methods/chat.postMessage function sendReportToSlack(tsv, slack) { - // post_attachments(channel_id, attachments, initial_comment) - slack.sendMessage(data) => json + const attachments = [ + { + filename: "test.tsv", + content: tsv, + } + ]; + + slack.post_attachments(SLACK_CHANNEL_ID, attachments, "This is the initial comment"); } diff --git a/apps/meteor/app/seeking-alpha/utils/Slack.ts b/apps/meteor/app/seeking-alpha/utils/Slack.ts index f41950271db5b..78025cb76e814 100644 --- a/apps/meteor/app/seeking-alpha/utils/Slack.ts +++ b/apps/meteor/app/seeking-alpha/utils/Slack.ts @@ -11,7 +11,7 @@ import { Logger } from '@rocket.chat/logger'; import { WebClient as SlackWebAPIClient } from '@slack/web-api'; -import { SlackAPI as RocketChatSlackbridgeAPI} from '../../slackbridge/server/SlackAPI'; +import { SlackAPI as RocketChatSlackbridgeAPI } from '../../slackbridge/server/SlackAPI'; export default class Slack { constructor(apiOrBotToken) { diff --git a/apps/meteor/server/importPackages.ts b/apps/meteor/server/importPackages.ts index 50513b92d83d5..19002a1a4bb96 100644 --- a/apps/meteor/server/importPackages.ts +++ b/apps/meteor/server/importPackages.ts @@ -85,4 +85,4 @@ import '../app/reactions/server'; import '../app/livechat/server'; import '../app/authentication/server'; import '../app/voip/server/startup'; -import '../app/seeking-alpha/term-of-use-violations/server'; +import '../app/seeking-alpha/terms-of-use-violations';