From 8d05fbd79ab08d82107ef7a7c8130b2c41db96cf Mon Sep 17 00:00:00 2001 From: Kazuhiro Sera Date: Wed, 24 Mar 2021 13:39:45 +0900 Subject: [PATCH] Fix #632 Add Japanese version of PR #626 (App Home document) --- docs/_basic/ja_authenticating_oauth.md | 2 +- .../_basic/ja_listening_responding_options.md | 2 +- docs/_basic/ja_publishing_views.md | 50 +++++++++++++++++++ 3 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 docs/_basic/ja_publishing_views.md diff --git a/docs/_basic/ja_authenticating_oauth.md b/docs/_basic/ja_authenticating_oauth.md index 164803c32..48b0de91c 100644 --- a/docs/_basic/ja_authenticating_oauth.md +++ b/docs/_basic/ja_authenticating_oauth.md @@ -2,7 +2,7 @@ title: OAuth フローの実装 lang: ja-jp slug: authenticating-oauth -order: 14 +order: 15 ---
diff --git a/docs/_basic/ja_listening_responding_options.md b/docs/_basic/ja_listening_responding_options.md index 55a918dd1..2a131825d 100644 --- a/docs/_basic/ja_listening_responding_options.md +++ b/docs/_basic/ja_listening_responding_options.md @@ -2,7 +2,7 @@ title: オプションのリスニングと応答 lang: ja-jp slug: options -order: 13 +order: 14 ---
diff --git a/docs/_basic/ja_publishing_views.md b/docs/_basic/ja_publishing_views.md new file mode 100644 index 000000000..da5df3c4b --- /dev/null +++ b/docs/_basic/ja_publishing_views.md @@ -0,0 +1,50 @@ +--- +title: ホームタブの更新 +lang: ja-jp +slug: publishing-views +order: 13 +--- + +
+ホームタブは、サイドバーや検索画面からアクセス可能なサーフェスエリアです。アプリはこのエリアを使ってユーザーごとのビューを表示することができます。アプリ設定ページで App Home の機能を有効にすると、`views.publish` API メソッドの呼び出しで `user_id` とビューのペイロードを指定して、ホームタブを公開・更新することができるようになります。 + +エンドユーザーが App Home(ホームタブやアプリとの DM など)にアクセスしたことを知るために、`app_home_opened` イベントをサブスクライブすることができます。 +
+ +```javascript +// ユーザーが App Home にアクセスしたことを伝えるイベントをリッスン +app.event('app_home_opened', async ({ event, client }) => { + try { + // 組み込みの API クライアントを使って views.publish を呼び出す + const result = await client.views.publish({ + // イベントに紐づけられたユーザー ID を指定 + user_id: event.user, + view: { + // ホームタブはあらかじめアプリ設定ページで有効にしておく必要があります + "type": "home", + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*Welcome home, <@" + event.user + "> :house:*" + } + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "Learn how home tabs can be more useful and interactive ." + } + } + ] + } + }); + + console.log(result); + } + catch (error) { + console.error(error); + } +}); +``` \ No newline at end of file