@slack

@slack defines Slack app HTTP handlers

Each defined Slack app gets a set of four HTTP handlers (API Gateway wired to Lambda) for:

Read more about creating Slack apps here.

Validation

  • Lowercase alphanumeric string
  • Maximum of 50 characters
  • Dashes are allowed; underscores are not allowed
  • Must begin with a letter

Additional bits

  • @slack requires at least one @html or @json route handler created
  • Protip: all the generated handlers come installed with Slack

Example

This .arc file defines two Slack apps:

@app
testapp

@http
get /

@slack
hello-bot
rando-emoji

Given the .arc file above npx create generates the following functions:

/
├── http
│   └── get-index/
├── slack
│   ├── hello-bot-actions/
│   ├── hello-bot-events/
│   ├── hello-bot-options/
│   ├── hello-bot-slash/
│   ├── rando-emoji-actions/
│   ├── rando-emoji-events/
│   ├── rando-emoji-options/
│   └── rando-emoji-slash/
├── .arc
└── package.json

This is a complete Slack app example .arc file:

@app
testapp

@slack
bot

@http
get /
get /sign-in-with-slack
get /add-to-slack

Results in the following code:

/
├── http
│   ├── get-add-to-slack/
│   ├── get-sign-in-with-slack/
│   └── get-index/
├── slack
│   ├── bot-actions/
│   ├── bot-events/
│   ├── bot-options/
│   └── bot-slash/
├── .arc
└── package.json

Next: Uploading static assets to S3 with @static