| 1 | #WorkflowStep |
| 2 | |
| 3 | Have you ever wanted to run an app from a Slack workflow? This sample app shows you how it works. |
| 4 | |
| 5 | Slack describes some of the basics here: |
| 6 | https://api.slack.com/workflows/steps |
| 7 | https://api.slack.com/tutorials/workflow-builder-steps |
| 8 | |
| 9 | |
| 10 | 1. Start the example app localy on port 8080 |
| 11 | |
| 12 | |
| 13 | 2. Use ngrok to expose your app to the internet |
| 14 | |
| 15 | ```shell |
| 16 | ./ngrok http 8080 |
| 17 | ``` |
| 18 | Copy the https forwarding URL and paste it into the app manifest down below (event_subscription request_url and interactivity request_url) |
| 19 | |
| 20 | |
| 21 | 3. Create a new Slack App at api.slack.com/apps from an app manifest |
| 22 | |
| 23 | The manifest of a sample Slack App looks like this: |
| 24 | ```yaml |
| 25 | display_information: |
| 26 | name: Workflowstep-Example |
| 27 | features: |
| 28 | bot_user: |
| 29 | display_name: Workflowstep-Example |
| 30 | always_online: false |
| 31 | workflow_steps: |
| 32 | - name: Example Step |
| 33 | callback_id: example-step |
| 34 | oauth_config: |
| 35 | scopes: |
| 36 | bot: |
| 37 | - workflow.steps:execute |
| 38 | settings: |
| 39 | event_subscriptions: |
| 40 | request_url: https://*****.ngrok.io/api/v1/example-step |
| 41 | bot_events: |
| 42 | - workflow_step_execute |
| 43 | interactivity: |
| 44 | is_enabled: true |
| 45 | request_url: https://*****.ngrok.io/api/v1/interaction |
| 46 | org_deploy_enabled: false |
| 47 | socket_mode_enabled: false |
| 48 | token_rotation_enabled: false |
| 49 | ``` |
| 50 | |
| 51 | ("Interactivity" and "Enable Events" should be turned on) |
| 52 | |
| 53 | 4. Slack Workflow (**paid plan required!**) |
| 54 | 1. Create a new Workflow at app.slack.com/workflow-builder |
| 55 | 2. give it a name |
| 56 | 3. select "Planned date & time" |
| 57 | 4. add another step and select "Example Step" from App Workflowstep-Example |
| 58 | 5. configure your app and hit save |
| 59 | 6. don't forget to publish your workflow |