何番煎じかわかりませんが、Slack Platformのチュートリアルを触ってみます。
今までのSlack APIを使ったアプリとは違い、Slackのクラウド環境で実行されるので、GASやAWS Lambdaなどを利用する必要がありません。
公式ドキュメント | https://api.slack.com/future/quickstart |
---|---|
サンプルリポジトリ | https://github.com/slack-samples/deno-starter-template |
manifest.ts
アプリの名前や、スコープを設定したりするTypescriptファイルです。
// manifest.ts
import { Manifest } from "deno-slack-sdk/mod.ts";
// Import your workflow
import GreetingWorkflow from "./workflows/greeting_workflow.ts";
export default Manifest({
// This is the internal name for your app.
// It can contain spaces (e.g., "My App")
name: "deno-hello-world",
// A description of your app that will help users decide whether to use it.
description: "A sample that demonstrates using a function, workflow and trigger to send a greeting",
// Your app's profile picture that will appear in the Slack client.
icon: "assets/default_new_app_icon.png",
// A list of all workflows your app will use.
workflows: [GreetingWorkflow],
// If your app communicates to any external domains, list them here.
outgoingDomains: [], // e.g., myapp.tld
// Bot scopes can be declared here.
// For the beta, you can keep these as-is.
botScopes: ["commands", "chat:write", "chat:write.public"],
});
slack.json
後述するSlack CLIがSDKの依存関係とやり取りする際に利用され、SDKによって実装されるスクリプトフックが含まれている。
/functions
関数は、「チャンネル作成」や「メッセージ送信」などの単体のSlackAPIで行えるようなアクションが定義されたBuilt-in functions
と、自身で定義するCustom functions
があります。
Built-in functionsは以下のようにSchema.slack.functionsの子になっており、単独で使用したり、後述するワークフローのステップとして利用することができます。