みなさん、こんにちは。どんぶラッコです。
今日は Slackアプリを使ってパブリックチャンネルに投稿できるSlackアプリの権限設定の手順について記述します!
アプリを作成

アプリ名と どのワークスペースのアプリとして開発するかを選択し、 Create App を押します。

アプリの設定画面に遷移するので、次にこのアプリができることを選択します。
OAuth & Permissionsを選択します。

Scopesの中にある Add an OAuth Scope をクリックします。

今回はチャンネルに登録せずにチャンネルへのメッセージ投稿ができるようにしたいので、 chat:write.public
を選択します。

すると、 chat:write
も追加するよ、と言われるので Add Scope を選択肢ます。

ここまでできたら ワークスペースにアプリを追加し、期待通りの動作ができるか確認してみましょう。
ページ上部に戻り、 OAuth & Redirect URLs から Install to Workspace を選択します。

権限を確認し、Allowを押下します。

すると OAuth Token が発行されます。

このtokenを使って、送信ができるかテストしてみましょう。
#oauthtest
というチャンネルに送信してみることにします。

アプリの設定を開きましょう。
メッセージを送信するには postMessage
メソッドを使います。テストページから送信してみましょう。
https://api.slack.com/methods/chat.postMessage/test
tokenに先程発行したtokenを、channelに送信したいチャンネル名を入力します。

そして、 text
に送信したいメッセージを入力した後、 TestMethod
を実行します。

このようにメッセージが送信されていれば成功です!

以上、アプリの使い方でした。これをベースにシステムに組み込んでいけば良いですね!