Open harshbhardwaj29 opened 5 months ago
Hey @harshbhardwaj29 👋 You're right that workflows are included in the app manifest, but triggers are tricky and act as separate entities from this and have to be created after installing the app.
create
, delete
, list
, and update
trigger details, as well as collecting info
or change edit access
.Hopefully this is helpful, but please follow up with any other questions! I hope to return with an update on these endpoints soon. And I'm also curious if you can share more about the production scale you're facing and how you'd ideally like to manage your triggers? It's really helpful feedback for us to make improvements in this area!
@zimeg The slack app i have is mostly configuration based, no code structure exists like workflows, trigger folders, i have created workflows and embed into app manifest, but the concern are the trigger creation and deployment, with folder structure exists in docs, it is possible to manage trigger using CLI but there is no mentions for creating trigger without the code structure, any points on that.
Would creating triggers from only JSON definitions be suitable for you? These would still be separate from your manifest but wouldn't act as active code :thinking:
If so, a link trigger can be defined as so:
{
"type": "shortcut",
"name": "Begin an automated process",
"description": "A sample trigger",
"workflow": "#/workflows/sample_workflow",
"inputs": {
"channel": {
"value": "{{data.channel_id}}"
}
}
}
And event triggers like so:
{
"type": "event",
"name": "Respond to a rocket reaction",
"description": "responds to a specific reactji",
"workflow": "#/workflows/sample_workflow",
"event": {
"event_type": "slack#/events/reaction_added",
"channel_ids": [
"C0123456789"
],
"filter": {
"version": 1,
"root": {
"statement": "{{data.reaction}} == rocket"
}
}
},
"inputs": {
"channel": {
"value": "C0123456789"
}
}
}
Edit: The CLI can then manage triggers using these files with slack trigger create --trigger-def=<file>
@zimeg what should be the ideal place to have these triggers, so it can pull mapping of workflows in app manifest like
"workflow": "#/workflows/sample_workflow"
@harshbhardwaj29 as long as your manifest includes the #/workflows/sample_workflow
these trigger definitions can exist anywhere!
I might suggest a triggers
directory to keep things tidy. Updating values of the trigger definition is possible, but would require a bit of JSON processing at some point to override the workflow
value with something from your manifest. Once the trigger endpoints are public, currently a WIP, this might become easier as changes could happen during runtime.
Question
I have a use case to create new triggers for invoking workflows. I understand workflows can bundled into JSON/YAML into slack app workspace.
Context
I did not found any documents managing and creating triggers at scale in production like slack apps.
Environment
@slack/deno-slack-sdk": "^2.10.0"
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.