deno-slack-sdk: [QUERY] How to listen on all channels or joined channels when create a event trigger like app_mentioned

Question

When I follow the tutorials to create a event trigger, I don’t know how to set the event propoty.

const trigger: Trigger<typeof AppMentionedWorkflow.definition> = {
  type: TriggerTypes.Event,
  name: "Mentioned response",
  description: "responds to mentioned event",
  workflow: `#/workflows/${AppMentionedWorkflow.definition.callback_id}`,
  event: {
    event_type: TriggerEventTypes.AppMentioned,
    channel_ids: ["C123ABC456"], // <- my question is here, I can't hard code  the channel id
  },
  inputs: {
    message: {
      value: TriggerContextData.Event.AppMentioned.text,
    },
    channel: {
      value: TriggerContextData.Event.AppMentioned.channel_id,
    },
    user: {
      value: TriggerContextData.Event.AppMentioned.user_id,
    },
  },
};

About this issue

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

Most upvoted comments

It’s true, the new automation platform supports less events at this time compared to the old platform. There are many security and permission considerations related to tokens, workflows and an entire new persona (the builder persona: the person that builds workflows in Workflow Builder, possibly using functions from other third party apps) that need careful review and refactor, all the while maintaining backwards compatibility for the existing platform.

We will be working to improve that, but it will take time. In the mean time, I will certainly forward this feedback to our team so that we can weigh it when prioritizing work.

We can update the trigger’s Channel Ids at runtime programmatically using the below method. https://api.slack.com/automation/triggers/manage#update_runtime

@filmaj these are great thoughts. I think in the meantime, we will expand our CI/CD scripts to detect when a commit contains a trigger/workflow def change and throw an error/warning reminder. It’s a simple solution while y’all continue to explore improvements for the slack cli.

@filmaj false alarm! Your second bullet reminded me that our team had not run the slack trigger update command. After doing so and re-deploying, it works as expected.

For what it’s worth, we definitely expected the slack deploy command to act as a rebuild of the trigger definitions. Sorry for dragging you into this rabbit hole.

Going to re-open this issue and investigate. A couple of requests:

  • what Slack plan is your workspace on? Is it a standalone workspace or part of an Enterprise Grid / org?
  • are you editing an existing trigger to introduce all_resources, or creating a new one?
  • can you share your workflow definition?

The above is mostly so that I can try to reproduce the problem. Appreciate your patience and assistance in providing this info 🙇

This is now out in deno-slack-sdk 2.10 and deno-slack-api 2.4!