Skip to content

Commit 0f943e7

Browse files
merge conflicts
2 parents 7675e83 + beba392 commit 0f943e7

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

docs/english/concepts/ai-apps.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: AI Apps
2+
title: Using AI in Apps
33
lang: en
44
slug: /concepts/ai-apps
55
---
@@ -8,7 +8,7 @@ slug: /concepts/ai-apps
88
If you don't have a paid workspace for development, you can join the [Developer Program](https://api.slack.com/developer-program) and provision a sandbox with access to all Slack features for free.
99
:::
1010

11-
AI apps comprise a new messaging experience for Slack. If you're unfamiliar with using AI apps within Slack, you'll want to read the [API documentation on the subject](/ai/). Then come back here to implement them with Bolt!
11+
The Agents & AI Apps feature comprises a unique messaging experience for Slack. If you're unfamiliar with using the Agents & AI Apps feature within Slack, you'll want to read the [API documentation on the subject](/ai/). Then come back here to implement them with Bolt!
1212

1313
## Configuring your app to support AI features {#configuring-your-app}
1414

@@ -28,11 +28,16 @@ AI apps comprise a new messaging experience for Slack. If you're unfamiliar with
2828

2929
That being said, using the `Assistant` class will streamline the process. And we already wrote this nice guide for you!
3030

31+
<<<<<<< HEAD:docs/english/concepts/ai-apps.md
32+
=======
33+
:::info
34+
You _could_ go it alone and [listen](event-listening) for the `assistant_thread_started`, `assistant_thread_context_changed`, and `message.im` events (see implementation details below) in order to implement the AI features in your app. That being said, using the `Assistant` class will streamline the process. And we already wrote this nice guide for you!
35+
>>>>>>> origin:docs/content/concepts/ai-apps.md
3136
:::
3237

3338
## The `Assistant` class instance {#assistant-class}
3439

35-
The `Assistant` class can be used to handle the incoming events expected from a user interacting with an AI app in Slack. A typical flow would look like:
40+
The `Assistant` class can be used to handle the incoming events expected from a user interacting with an app in Slack that has the Agents & AI Apps feature enabled. A typical flow would look like:
3641

3742
1. [The user starts a thread](#handling-a-new-thread). The `Assistant` class handles the incoming [`assistant_thread_started`](/reference/events/assistant_thread_started) event.
3843
2. [The thread context may change at any point](#handling-thread-context-changes). The `Assistant` class can handle any incoming [`assistant_thread_context_changed`](/reference/events/assistant_thread_context_changed) events. The class also provides a default context store to keep track of thread context changes as the user moves through Slack.
@@ -108,12 +113,19 @@ If you do provide your own `threadContextStore` property, it must feature `get`
108113

109114
## Handling a new thread {#handling-a-new-thread}
110115

116+
<<<<<<< HEAD:docs/english/concepts/ai-apps.md
111117
When the user opens a new thread with your AI app, the [`assistant_thread_started`](/reference/events/assistant_thread_started) event will be sent to your app.
112118

113119
:::tip[When a user opens an AI app thread while in a channel, the channel info is stored as the thread's `AssistantThreadContext` data. You can grab that info by using the `get_thread_context` utility, as subsequent user message event payloads won't include the channel info.]
120+
=======
121+
When the user opens a new thread with your AI-enabled app, the [`assistant_thread_started`](https://docs.slack.dev/reference/events/assistant_thread_started) event will be sent to your app.
122+
123+
:::tip
124+
When a user opens an app thread while in a channel, the channel info is stored as the thread's `AssistantThreadContext` data. You can grab that info by using the `get_thread_context` utility, as subsequent user message event payloads won't include the channel info.
125+
>>>>>>> origin:docs/content/concepts/ai-apps.md
114126
:::
115127

116-
### Block Kit interactions in the AI app thread {#block-kit-interactions}
128+
### Block Kit interactions in the app thread {#block-kit-interactions}
117129

118130
For advanced use cases, Block Kit buttons may be used instead of suggested prompts, as well as the sending of messages with structured [metadata](/messaging/message-metadata/) to trigger subsequent interactions with the user.
119131

docs/english/concepts/listener-middleware.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ If your listener middleware is a quite simple one, you can use a listener matche
1111
Refer to [the module document](https://docs.slack.dev/bolt-python/api-docs/slack_bolt/kwargs_injection/args.html) to learn the available listener arguments.
1212

1313
```python
14-
# Listener middleware which filters out messages with "bot_message" subtype
14+
# Listener middleware which filters out messages from a bot
1515
def no_bot_messages(message, next):
16-
subtype = message.get("subtype")
17-
if subtype != "bot_message":
18-
next()
16+
if "bot_id" not in message:
17+
next()
1918

2019
# This listener only receives messages from humans
2120
@app.event(event="message", middleware=[no_bot_messages])
@@ -24,10 +23,10 @@ def log_message(logger, event):
2423

2524
# Listener matchers: simplified version of listener middleware
2625
def no_bot_messages(message) -> bool:
27-
return message.get("subtype") != "bot_message"
26+
return "bot_id" not in message
2827

2928
@app.event(
30-
event="message",
29+
event="message",
3130
matchers=[no_bot_messages]
3231
# or matchers=[lambda message: message.get("subtype") != "bot_message"]
3332
)

docs/japanese/concepts/listener-middleware.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ slug: /concepts/listener-middleware
1111
<span>指定可能な引数の一覧は<a href="https://docs.slack.dev/bolt-python/api-docs/slack_bolt/kwargs_injection/args.html">モジュールドキュメント</a>を参考にしてください。</span>
1212

1313
```python
14-
# "bot_message" サブタイプのメッセージを抽出するリスナーミドルウェア
14+
# ボットからのメッセージをフィルタリングするリスナーミドルウェア
1515
def no_bot_messages(message, next):
16-
subtype = message.get("subtype")
17-
if subtype != "bot_message":
18-
next()
16+
if "bot_id" not in message:
17+
next()
1918

2019
# このリスナーは人間によって送信されたメッセージのみを受け取ります
2120
@app.event(event="message", middleware=[no_bot_messages])
@@ -24,13 +23,13 @@ def log_message(logger, event):
2423

2524
# リスナーマッチャー: 簡略化されたバージョンのリスナーミドルウェア
2625
def no_bot_messages(message) -> bool:
27-
return message.get("subtype") != "bot_message"
26+
return "bot_id" not in message
2827

2928
@app.event(
30-
event="message",
29+
event="message",
3130
matchers=[no_bot_messages]
3231
# or matchers=[lambda message: message.get("subtype") != "bot_message"]
3332
)
3433
def log_message(logger, event):
3534
logger.info(f"(MSG) User: {event['user']}\nMessage: {event['text']}")
36-
```
35+
```

0 commit comments

Comments
 (0)