deno-slack-sdk: [QUERY] Trigger Event filter out thread messages

Question

Hello! Am trying to work on an event trigger that listens for message reactions but I would like to filter out all events on a thread message, so if user reacts a given emoji on main message of a thread it proceeds and if the message is a thread reply then it halts.

Context

import {
  TriggerContextData,
  TriggerEventTypes,
  TriggerTypes,
} from "deno-slack-api/mod.ts";
import { Trigger } from "deno-slack-api/types.ts";
import "std/dotenv/load.ts";
import { MessageReactionsWorkflow } from "../workflows/message_reactions.ts";

const trigger: Trigger<typeof MessageReactionsWorkflow.definition> = {
  type: TriggerTypes.Event,
  name: "Message reaction listener",
  description: "Listen to specific message reactions and trigger a workflow",
  workflow: `#/workflows/${MessageReactionsWorkflow.definition.callback_id}`,
  event: {
    event_type: TriggerEventTypes.ReactionAdded,
    channel_ids: [Deno.env.get("PLATFORM_CHANNEL")!],
    filter: {
      version: 1,
      root: {
        operator: "OR",
        inputs: [
          { statement: "{{data.reaction}} == white_check_mark" },
          { statement: "{{data.reaction}} == eyes" },
          { statement: "{{data.reaction}} CONTAINS clock" },
        ],
      },
    },
  },
  inputs: {
    reaction: {
      value: TriggerContextData.Event.ReactionAdded.reaction,
    },
    message_context: {
      value: TriggerContextData.Event.ReactionAdded.message_context,
    },
    user_id: {
      value: "{{data.user_id}}",
    }
  },
};

export default trigger;

Environment

"deno-slack-sdk/": "https://deno.land/x/deno_slack_sdk@2.9.0/",
"deno-slack-api/": "https://deno.land/x/deno_slack_api@2.3.2/",
deno 1.42.4 (release, aarch64-apple-darwin)
v8 12.3.219.9
typescript 5.4.3
ProductName:		macOS
ProductVersion:		14.4.1
BuildVersion:		23E224
Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:49 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6020

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Hey @WilliamBergamin although I still canโ€™t see the trigger being listed under the trigger list I can confirm itโ€™s working!

Thank you so much for crushing this bug ๐Ÿ›

I see, I was able to reproduce your behavior

This does not seem like we completely fixed the issue

Hi @gilhrpenner thanks again for bringing this up, this was a bug and a patch has been shipped, Iโ€™ve tested it this morning and the nested OR in a AND operator works on my end ๐Ÿ™Œ

You may need to recreate your trigger, let me know if this resolves the issue

Hi @gilhrpenner the issue with the OR nested inside an AND is a bug on the backend, I am currently collecting more information on the bug

Thank you for bringing this forward ๐Ÿ™