Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Add --output string flag to slack trigger list (or even globally) #282

Open
NathanHRich opened this issue Feb 21, 2024 · 1 comment
Labels
feature request New feature or request

Comments

@NathanHRich
Copy link

I have a bunch of lingering event triggers that I've created programmatically that I need to clean up. I'd like it to be easier to do this programmatically.
I've noticed the --output string flag is available for slack datastore query. That's what I'm looking for, but for triggers.

When running the slack trigger list command, I've noticed there is a JSON response in the logs. It looks like the CLI then iterates over the triggers in that initial response to get additional info about users, permissions, etc. It would be great if I were able to supply an output flag or output file to dump the initial JSON body to. i.e. slack trigger list --type event --limit 1000 --team TEAM_ID --app APP_ID --output json or --output_file triggers.json

Really almost every Slack CLI command I've used appears to have a JSON response in the logs, having a global --output string flag would be excellent 🔥

Alternative solutions

I was able to find a workaround by hitting the API endpoint listed in the logs. Using a token generated with slack auth token

POST https://slack.com/api/workflows.triggers.list?token=SLACK_TOKEN
Headers: Content-Type application/json
Body: {"app_id":"APP_ID","limit":1000,"type":"event"}

I would expect this endpoint to be documented at https://api.slack.com/methods/workflows.triggers.list, but at the time of writing this, it's not. So keep that in mind if using this workaround.


More details about my use-case:
I have a workflow that creates an event trigger to monitor a specific thread. Messages in that thread get passed to our ticketing management system through the triggered workflow.
Upon trigger creation, I store the trigger id, along with some other info, in a Slack datastore. When the ticket is closed, the trigger and related datastore entry both get deleted.
As with any solution, things slip through the cracks. That's where this cleanup task I'm working on comes in. My solution gets all the tickets in the datastore, checks their status in our ticketing system, and cleans up the trigger and datastore entry if certain conditions are met.

@zimeg zimeg added the feature request New feature or request label Feb 21, 2024
@zimeg
Copy link
Member

zimeg commented Feb 21, 2024

Hey @NathanHRich! This is such a great request. I totally agree that having consumable outputs would make scripting tasks like this much easier, but I'm glad to hear you've found a workaround for now. Pretty clever, poking into the debug logs 😉

I'll share this with the team and hope to return with an update soon! Thanks a ton for sharing your use case with this request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants