CHASER FORM TASKS — SLACK-HOSTED APP

This adds “Create a Chaser task” to Slack Workflow Builder. After deployment,
Slack runs the step. Your computer and terminal can be closed.

ONE-TIME SETUP

You need a paid Slack workspace with Workflow Builder, permission to install
an app, and Chaser in that workspace. Your administrator may need to approve
the app. The person whose Chaser API key you use should have created a Chaser
task in Slack and be a member of the destination channel.

Install Slack CLI and Deno once on the computer you use for setup:

Slack CLI for macOS or Linux:
https://docs.slack.dev/tools/slack-cli/guides/installing-the-slack-cli-for-mac-and-linux/

Slack CLI for Windows:
https://docs.slack.dev/tools/slack-cli/guides/installing-the-slack-cli-for-windows/

Deno for either platform:
https://docs.deno.com/runtime/getting_started/installation/

Unzip the download. Open Terminal (macOS/Linux) or PowerShell (Windows). If you
extracted the folder into Downloads, enter:

  cd ~/Downloads/chaser-slack-workflow-app

If you extracted it somewhere else, change that path to match. You should now
be in the folder containing manifest.ts. Run these commands one at a time:

  slack login
  slack deploy

Follow the login prompts. At deployment, choose “Install to a new workspace”
and your intended workspace. This creates “Chaser Form Tasks” from the included
files and hosts it on Slack.

In the Chaser dashboard, open Connect → API Keys → Add Another Key. Enter
“Slack workflow intake demo” as the label and click Create. Click the copy icon
beside the new masked key. This key lets the app create tasks as the key owner,
so keep it private. Use the account described in the prerequisites above.

After deployment finishes, run the third command:

  slack env set CHASER_API_KEY

Choose the DEPLOYED “Chaser Form Tasks” app if prompted. When asked for the
value, paste the actual Chaser API key, not its label. Slack stores it for the
deployed app. Keep it out of source files, screenshots, and shared commands.

Setup is complete. You can close your terminal and turn off your computer;
Slack runs the step when a workflow calls it. No local process, separate host,
Slack bot token, or app-level token needs to be managed.

BUILD THE WORKFLOW

In Slack Workflow Builder, create a workflow that starts from a link. Add a
“Collect info in a form” step with four required questions:

  What do you need?          Short answer
  What should we know?      Paragraph
  Who should own this?      Slack user
  When is it due?           Date

Add “Create a Chaser task” from “Chaser Form Tasks” after the form. Map:

  Deliverable   = Answer to “What do you need?”
  Brief         = Answer to “What should we know?”
  Task owner    = Answer to “Who should own this?”
  Due date      = Answer to “When is it due?”
  Task channel  = Your chosen channel
  Requested by  = Person who submitted the form

Publish with “Workflow managers only” access for the first test. Open the
workflow link and submit a sample request. Check the task in the chosen channel
and confirm both steps completed in the workflow's Activity Log. The task should
contain the title, brief and requester, with the selected owner and due date.
The API key owner creates the task; the requester is recorded in its text.

The person who deployed the app can add its step to workflows by default.
If other people need to BUILD workflows with this step, use:

  slack function access --name create_chaser_task
  slack deploy

Choose who can use the step when prompted, then deploy the updated access.
Workflow sharing is controlled separately in Workflow Builder. Refresh Slack
if the step is missing.

CHECKS AND LIMITS

The function sends form details to the Chaser API at api.trychaser.com. It makes
one request per invocation and does not retry. A timeout can happen after Chaser
creates a task, so check the channel before submitting the form again. This
starter does not keep a persistent record to prevent duplicate requests.
Do not enable SLACK_DEBUG with real keys or submissions: it logs full payloads.

Keep this project folder for future updates. After changing the app's code,
run slack deploy again to update the hosted app.

References:
https://docs.slack.dev/tools/deno-slack-sdk/tutorials/workflow-builder-custom-step/
https://docs.slack.dev/tools/deno-slack-sdk/guides/using-environment-variables/
https://docs.slack.dev/tools/slack-cli/reference/commands/slack_env_set/
https://docs.slack.dev/tools/deno-slack-sdk/guides/controlling-access-to-custom-functions/
https://github.com/slack-samples/deno-starter-template/blob/main/deno.jsonc
https://github.com/slackapi/deno-slack-hooks/releases/tag/1.5.0
