Skip to content

Commit e43b65c

Browse files
committed
Add guide for response_urls in modals
1 parent 8a37843 commit e43b65c

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

docs/guides/ja/modals.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,12 @@ ctx.ackWithUpdate(renewedView)
355355
ctx.ackWithPush(newViewInStack)
356356
```
357357

358+
#### モーダル送信後にメッセージを投稿
359+
360+
`view_submission` のペイロードはデフォルトでは `response_url` を含んでいません。しかし、モーダルがユーザーにメッセージを投稿するためのチャンネルを入力するよう求める `input` タイプのブロックを含む場合、ペイロード内の `response_urls` として URL を受け取ることができます。
361+
362+
これを有効にするためには [`channels_select`](https://api.slack.com/reference/block-kit/block-elements#channel_select) もしくは [`conversations_select`](https://api.slack.com/reference/block-kit/block-elements#conversation_select) のタイプのブロックエレメントを配置し、さらにその属性として `"response_url_enabled": true` を追加してください。より詳細な情報は [API ドキュメント(英語)](https://api.slack.com/surfaces/modals/using#modal_response_url)を参照してください。
363+
358364
### `"view_closed"` リクエスト (`notify_on_close` が `true` のときのみ)
359365

360366
BoltSlack アプリに必要な共通処理の多くを巻き取ります。それを除いて、あなたのアプリがやらなければならない手順は以下の通りです。

docs/guides/ja/shortcuts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Bolt は Slack アプリに必要な共通処理の多くを巻き取ります
4646

4747
メッセージショートカットのペイロードは `response_url` を持っており、例えば `ack()` した後、しばらく経ってからでも返信することができます。URL は発行されてから 30 分間を期限に最大 5 回まで使用することができます。処理が終わったタイミングで `response_url` を使って返信する場合は `ctx.ack()` は引数なしで実行し `ctx.respond()` でメッセージを投稿する、というやり方になります。グローバルショートカットのペイロードには `response_url` は含まれません。
4848

49-
グローバルショートカットのペイロードは、デフォルトでは `response_url` を持っていません。しかし、モーダルの中にユーザーにチャンネルを入力してもらうためのブロックがある場合は `response_urls` という項目で受け取ることができます。これを利用するためには [`channels_select`](https://api.slack.com/reference/block-kit/block-elements#channel_select)[`conversations_select`](https://api.slack.com/reference/block-kit/block-elements#conversation_select) の input type の block element を用意し、かつ、その属性に `"response_url_enabled": true` を設定してください。
49+
グローバルショートカットのペイロードは、デフォルトでは `response_url` を持っていません。しかし、モーダルの中にユーザーにチャンネルを入力してもらうための `input` タイプのブロックがある場合は `response_urls` という項目で受け取ることができます。これを利用するためには [`channels_select`](https://api.slack.com/reference/block-kit/block-elements#channel_select)[`conversations_select`](https://api.slack.com/reference/block-kit/block-elements#conversation_select) の input type の block element を用意し、かつ、その属性に `"response_url_enabled": true` を設定してください。
5050

5151
以下のサンプルは、ショートカットのリクエストに応答する Bolt アプリの実装の例です。
5252

docs/guides/modals.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,12 @@ ctx.ack { it.responseAction("update").view(renewedView) }
347347
ctx.ack { it.responseAction("push").view(newViewInStack) }
348348
```
349349

350+
#### Publishing Messages After Modal Submissions
351+
352+
`view_submission` payloads don't have `response_url` by default. However, if you have an `input` block asking users a channel to post a message, payloads may provide `response_urls`.
353+
354+
To enable this, set the block element type as either [`channels_select`](https://api.slack.com/reference/block-kit/block-elements#channel_select) or [`conversations_select`](https://api.slack.com/reference/block-kit/block-elements#conversation_select) and add `"response_url_enabled": true`. Refer to [the API document](https://api.slack.com/surfaces/modals/using#modal_response_url) for details.
355+
350356
### `"view_closed"` requests (only when `notify_on_close` is `true`)
351357
352358
Bolt does many of the commonly required tasks for you. The steps you need to handle would be:

docs/guides/shortcuts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Bolt does many of the commonly required tasks for you. The steps you need to han
4545

4646
Message shortcut request payloads have `response_url`, so that your app can reply to the shortcut (even asynchronously after the acknowledgment). The URL is usable up to 5 times within 30 minutes of the shortcut invocation. If you post a message using `response_url`, call `ctx.ack()` without arguments and use `ctx.respond()` to post a message.
4747

48-
Global shortcut request payloads don't have `response_url` by default. If you have an input block element asking users a channel to post a message, global shortcut request payloads may provide `response_urls`. To enable this, set the block element type as either [`channels_select`](https://api.slack.com/reference/block-kit/block-elements#channel_select) or [`conversations_select`](https://api.slack.com/reference/block-kit/block-elements#conversation_select) and add `"response_url_enabled": true`.
48+
Global shortcut request payloads don't have `response_url` by default. If you have an `input` block asking users a channel to post a message, global shortcut request payloads may provide `response_urls`. To enable this, set the block element type as either [`channels_select`](https://api.slack.com/reference/block-kit/block-elements#channel_select) or [`conversations_select`](https://api.slack.com/reference/block-kit/block-elements#conversation_select) and add `"response_url_enabled": true`.
4949

5050
Here is a tiny example demonstrating how to handle shortcut requests in a Bolt app.
5151

0 commit comments

Comments
 (0)