Skip to content

Commit

Permalink
merge in main
Browse files Browse the repository at this point in the history
  • Loading branch information
misscoded committed Sep 3, 2020
2 parents c6842f1 + 605eb12 commit 47a53bf
Show file tree
Hide file tree
Showing 24 changed files with 86 additions and 74 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/gh-pages.yml

This file was deleted.

4 changes: 2 additions & 2 deletions docs/_basic/authenticating_oauth.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To learn more about the OAuth installation flow with Slack, [read the API docume
const app = new App({
signingSecret: process.env.SLACK_SIGNING_SECRET,
clientId: process.env.SLACK_CLIENT_ID,
clientSecret: process.env.SLACK_CLIENT_SECRET
clientSecret: process.env.SLACK_CLIENT_SECRET,
stateSecret: 'my-state-secret',
scopes: ['channels:read', 'groups:read', 'channels:manage', 'chat:write', 'incoming-webhook'],
installationStore: {
Expand Down Expand Up @@ -56,7 +56,7 @@ You can override the default OAuth using the `installerOptions` object, which ca
const app = new App({
signingSecret: process.env.SLACK_SIGNING_SECRET,
clientId: process.env.SLACK_CLIENT_ID,
clientSecret: process.env.SLACK_CLIENT_SECRET
clientSecret: process.env.SLACK_CLIENT_SECRET,
scopes: ['channels:read', 'groups:read', 'channels:manage', 'chat:write', 'incoming-webhook'],
installerOptions: {
authVersion: 'v1', // default is 'v2', 'v1' is used for classic slack apps
Expand Down
2 changes: 1 addition & 1 deletion docs/_basic/ja_acknowledging_requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ order: 7
```javascript
// Regex でメールアドレスが有効かチェック
let isEmail = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/
// 制約付きのオブジェクト を使用して ticket_submit という callback_id を持つダイアログ送信をリスニング
// 制約付きのオブジェクト を使用して ticket_submit という callback_id を持つダイアログ送信をリッスン
app.action({ callback_id: 'ticket_submit' }, async ({ action, ack }) => {
// メールアドレスが有効。ダイアログを受信
if (isEmail.test(action.submission.email)) {
Expand Down
4 changes: 2 additions & 2 deletions docs/_basic/ja_authenticating_oauth.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Slack の OAuth インストールフローについてもっと知りたい場
const app = new App({
signingSecret: process.env.SLACK_SIGNING_SECRET,
clientId: process.env.SLACK_CLIENT_ID,
clientSecret: process.env.SLACK_CLIENT_SECRET
clientSecret: process.env.SLACK_CLIENT_SECRET,
stateSecret: 'my-state-secret',
scopes: ['channels:read', 'groups:read', 'channels:manage', 'chat:write', 'incoming-webhook'],
installationStore: {
Expand Down Expand Up @@ -58,7 +58,7 @@ const app = new App({
const app = new App({
signingSecret: process.env.SLACK_SIGNING_SECRET,
clientId: process.env.SLACK_CLIENT_ID,
clientSecret: process.env.SLACK_CLIENT_SECRET
clientSecret: process.env.SLACK_CLIENT_SECRET,
scopes: ['channels:read', 'groups:read', 'channels:manage', 'chat:write', 'incoming-webhook'],
installerOptions: {
authVersion: 'v1', // デフォルトは 'v2' (クラシック Slack アプリは 'v1')
Expand Down
4 changes: 2 additions & 2 deletions docs/_basic/ja_listening_actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ order: 5
---

<div class="section-content">
Bolt アプリは `action` メソッドを用いて、ボタンのクリック、メニューの選択、メッセージショートカットなどのユーザーのアクションをリスニングすることができます
Bolt アプリは `action` メソッドを用いて、ボタンのクリック、メニューの選択、メッセージショートカットなどのユーザーのアクションをリッスンすることができます

アクションは文字列型の `action_id` または RegExp オブジェクトでフィルタリングできます。 `action_id` は、Slack プラットフォーム上のインタラクティブコンポーネントの一意の識別子として機能します。

Expand All @@ -29,7 +29,7 @@ app.action('approve_button', async ({ ack, say }) => {
</summary>

<div class="secondary-content" markdown="0">
制約付きのオブジェクトを使って、 `callback_id``block_id` 、および `action_id` (またはそれらの組み合わせ) をリスニングすることができます。オブジェクト内の制約には、文字列型または RegExp オブジェクトを使用できます。
制約付きのオブジェクトを使って、 `callback_id``block_id` 、および `action_id` (またはそれらの組み合わせ) をリッスンすることができます。オブジェクト内の制約には、文字列型または RegExp オブジェクトを使用できます。
</div>

```javascript
Expand Down
2 changes: 1 addition & 1 deletion docs/_basic/ja_listening_messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ order: 1
---

<div class="section-content">
[アプリが受信可能な](https://api.slack.com/messaging/retrieving#permissions)メッセージをリスニングするには`message` 型でないイベントを除外する `message()` メソッドを使用します。
[アプリが受信可能な](https://api.slack.com/messaging/retrieving#permissions)メッセージをリッスンするには`message` 型でないイベントを除外する `message()` メソッドを使用します。

`message()` は、`string` 型か `RegExp` 型の、指定パターンに一致しないメッセージを除外する `pattern` パラメーター(指定は必須ではありません)を受け付けます。
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/_basic/ja_listening_modals.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ order: 12
---

<div class="section-content">
<a href="https://api.slack.com/reference/block-kit/views">モーダルのペイロード</a>が入力のブロックを含む場合、その入力値を受け取るために <code>view_submission</code> のイベントをリスニングする必要があります。<code>view_submission</code> イベントをリスニングするためには、組み込みの <code>view()</code> メソッドを使用します。
<a href="https://api.slack.com/reference/block-kit/views">モーダルのペイロード</a>が入力のブロックを含む場合、その入力値を受け取るために <code>view_submission</code> のイベントをリッスンする必要があります。<code>view_submission</code> イベントをリッスンするためには、組み込みの <code>view()</code> メソッドを使用します。

<code>view()</code> メソッドは、文字列型または <code>RegeExp</code>型 の <code>callback_id</code> を必要とします。

Expand Down
2 changes: 1 addition & 1 deletion docs/_basic/ja_listening_responding_commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ order: 9
---

<div class="section-content">
スラッシュコマンドが実行されたイベントをリスニングするには、アプリで `command()` メソッドを使用します。メソッドの使用には文字列型の `commandName` の指定が必要です。
スラッシュコマンドが実行されたイベントをリッスンするには、アプリで `command()` メソッドを使用します。メソッドの使用には文字列型の `commandName` の指定が必要です。

アプリがスラッシュコマンドのイベントを受け取ったことを `ack()` の実行によって Slack に通知する必要があります。

Expand Down
4 changes: 2 additions & 2 deletions docs/_basic/ja_listening_responding_shortcuts.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ order: 8
<div class="section-content">
`shortcut()` メソッドは、[グローバルショートカット](https://api.slack.com/interactivity/shortcuts/using#global_shortcuts)[メッセージショートカット](https://api.slack.com/interactivity/shortcuts/using#message_shortcuts)の両方をサポートします。

ショートカットは、テキスト入力エリアや検索バーから起動できる Slack クライアント内の UI エレメントです。グローバルショートカットは、コンポーザーメニューまたは検索メニューから呼び出すことができます。メッセージショートカットは、メッセージのコンテキストメニュー内にあります。`shortcut()` メソッドを使って、これらのショートカットのイベントをリスニングすることができます。このメソッドには `callback_id` を文字列または正規表現のデータ型で設定します。
ショートカットは、テキスト入力エリアや検索バーから起動できる Slack クライアント内の UI エレメントです。グローバルショートカットは、コンポーザーメニューまたは検索メニューから呼び出すことができます。メッセージショートカットは、メッセージのコンテキストメニュー内にあります。`shortcut()` メソッドを使って、これらのショートカットのイベントをリッスンすることができます。このメソッドには `callback_id` を文字列または正規表現のデータ型で設定します。

グローバルショートカットのイベントは Slack へイベントを受信したことを知らせるために `ack()` メソッドで確認する必要があります。

Expand Down Expand Up @@ -75,7 +75,7 @@ app.shortcut('open_modal', async ({ shortcut, ack, context }) => {
</summary>

<div class="secondary-content" markdown="0">
制約付きオブジェクトを使って `callback_id``type` によるリスニングをすることができます。オブジェクト内の制約は文字列型または RegExp オブジェクトを使用できます。
制約付きオブジェクトを使って `callback_id``type` によるリスニングができます。オブジェクト内の制約は文字列型または RegExp オブジェクトを使用できます。

</div>

Expand Down
2 changes: 1 addition & 1 deletion docs/_basic/ja_responding_actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ app.action('approve_button', async ({ ack, say }) => {
</div>

```javascript
// "user_select" の action_id がトリガーされたアクションをリスニング
// "user_select" の action_id がトリガーされたアクションをリッスン
app.action('user_choice', async ({ action, ack, respond }) => {
await ack();
await respond(`You selected <@${action.selected_user}>`);
Expand Down
2 changes: 1 addition & 1 deletion docs/_basic/ja_sending_messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ order: 2
</div>

```javascript
// "knock knock" を含むメッセージをリスニングし、 "who's there?" というメッセージをイタリック体で送信
// "knock knock" を含むメッセージをリッスンし、 "who's there?" というメッセージをイタリック体で送信
app.message('knock knock', async ({ message, say }) => {
await say(`_Who's there?_`);
});
Expand Down
2 changes: 1 addition & 1 deletion docs/_basic/listening_responding_shortcuts.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ order: 8

The `shortcut()` method supports both [global shortcuts](https://api.slack.com/interactivity/shortcuts/using#global_shortcuts) and [message shortcuts](https://api.slack.com/interactivity/shortcuts/using#message_shortcuts).

Shortcuts are invokable UI elements within Slack clients. For global shortcuts, they are available in the composer and search menus. For message shortcuts, they are available in the context menus of messages. Your app can use the `shortcut()` method to listen to incoming shortcut events. The method requires a `callback_id` parameter of type `string` or `RegExp`.
Shortcuts are invokable entry points to apps. Global shortcuts are available from within search in Slack. Message shortcuts are available in the context menus of messages. Your app can use the `shortcut()` method to listen to incoming shortcut events. The method requires a `callback_id` parameter of type `string` or `RegExp`.

Shortcuts must be acknowledged with `ack()` to inform Slack that your app has received the event.

Expand Down
2 changes: 1 addition & 1 deletion docs/_includes/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<span class="version">
{% assign release = site.github.releases | where_exp: "release",
"release.tag_name contains '@slack/bolt'" | sort: "created_at" | reverse | pop %}
"release.prerelease == false" | sort: "created_at" | reverse | pop %}
<a href="{{ release[0].html_url }}">v{{ release[0].tag_name | remove: "@slack/bolt@" }}</a>
</span>
</div>
Expand Down
11 changes: 6 additions & 5 deletions docs/_steps/configuring_workflow_steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ Read the documentation for [`input` objects](https://api.slack.com/reference/wor
// Your app will be called when user adds your step to their workflow
app.action({ type: 'workflow_step_edit', callback_id: 'add_task' }, async ({ body, ack, client }) => {
// Acknowledge the event
ack();
await ack();
// Open the configuration modal using `views.open`
client.views.open({
await client.views.open({
trigger_id: body.trigger_id,
view: {
type: 'workflow_step',
Expand Down Expand Up @@ -81,16 +81,16 @@ app.action({ type: 'workflow_step_edit', callback_id: 'add_task' }, async ({ bod
});
});

app.views('add_task_config', async ({ ack, view, body, client }) => {
app.view('add_task_config', async ({ ack, view, body, client }) => {
// Acknowledge the submission
ack();
await ack();
// Unique workflow edit ID
let workflowEditId = body.workflow_step.workflow_step_edit_id;
// Input values found in the view's state object
let taskName = view.state.values.task_name_input.name;
let taskDescription = view.state.values.task_description_input.description;

client.workflows.updateStep({
await client.workflows.updateStep({
workflow_step_edit_id: workflowEditId,
inputs: {
taskName: { value: (taskName || '') },
Expand All @@ -109,4 +109,5 @@ app.views('add_task_config', async ({ ack, view, body, client }) => {
}
]
});
});
```
2 changes: 1 addition & 1 deletion docs/_steps/executing_workflow_steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ app.event('workflow_step_execute', async ({ event, client }) => {
let workflowExecuteId = event.workflow_step.workflow_step_execute_id;
let inputs = event.workflow_step.inputs;

client.workflows.stepCompleted({
await client.workflows.stepCompleted({
workflow_step_execute_id: workflowExecuteId,
outputs: {
taskName: inputs.taskName.value,
Expand Down
8 changes: 4 additions & 4 deletions docs/_tutorials/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,16 @@ Now you have a public-facing URL for your app that tunnels to your local machine
Under the **Enable Events** switch in the **Request URL** box, go ahead and paste in your URL. As long as your Bolt app is still running, your URL should become verified.

After your request URL is verified, scroll down to **Subscribe to Bot Events**. There are four events related to messages: `message.channels` (listens for messages in public channels), `message.groups` (listens for messages in private channels), `message.im` (listens for messages in the App Home/DM space), and `message.mpim` (listens for messages in multi-person DMs).
After your request URL is verified, scroll down to **Subscribe to Bot Events**. There are four events related to messages: `message.channels` (listens for messages in public channels that your app is added to), `message.groups` (listens for messages in private channels that your app is added to), `message.im` (listens for messages in the App Home/DM space), and `message.mpim` (listens for messages in multi-person DMs that your app is added to).

If you want your bot to listen to messages from everywhere it is, choose all four message events. After you’ve added the events you want your bot to listen to, click the green **Save Changes** button.
If you want your bot to listen to messages from everywhere it is added to, choose all four message events. After you’ve selected the events you want your bot to listen to, click the green **Save Changes** button.

---

### Listening and responding to a message
Your app is now ready for some logic. Let's start by using the `message()` method to attach a listener for messages.

The following example listens to all messages that contain the word "hello" and responds with "Hey there @user!"
The following example listens and responds to all messages in channels/DMs where your app has been added that contain the word "hello":

```javascript
const { App } = require('@slack/bolt');
Expand All @@ -182,7 +182,7 @@ app.message('hello', async ({ message, say }) => {
})();
```

If you restart your app, you should be able to add your bot user to a channel, send any message that contains "hello", and it will respond.
If you restart your app, so long as your bot user has been added to the channel/DM, when you send any message that contains "hello", it will respond.

This is a basic example, but it gives you a place to start customizing your app based on your own goals. Let's try something a little more interactive by sending a button rather than plain text.

Expand Down
Loading

0 comments on commit 47a53bf

Please sign in to comment.