Skip to content

Commit 6e0055f

Browse files
authored
feat(slack): added get message by timestamp and get thread tool (#2803)
* feat(slack): added get message tool * added get thread
1 parent ebbe67a commit 6e0055f

File tree

10 files changed

+653
-18
lines changed

10 files changed

+653
-18
lines changed

apps/docs/components/icons.tsx

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,17 +1855,25 @@ export function LinearIcon(props: React.SVGProps<SVGSVGElement>) {
18551855

18561856
export function LemlistIcon(props: SVGProps<SVGSVGElement>) {
18571857
return (
1858-
<svg
1859-
{...props}
1860-
xmlns='http://www.w3.org/2000/svg'
1861-
viewBox='0 0 24 24'
1862-
width='24'
1863-
height='24'
1864-
fill='none'
1865-
>
1866-
<rect width='24' height='24' rx='4' fill='#316BFF' />
1867-
<path d='M7 6h2v9h5v2H7V6Z' fill='white' />
1868-
<circle cx='17' cy='8' r='2' fill='white' />
1858+
<svg {...props} xmlns='http://www.w3.org/2000/svg' viewBox='0 0 180 181' fill='none'>
1859+
<path
1860+
fillRule='evenodd'
1861+
clipRule='evenodd'
1862+
d='M32.0524 0.919922H147.948C165.65 0.919922 180 15.2703 180 32.9723V148.867C180 166.57 165.65 180.92 147.948 180.92H32.0524C14.3504 180.92 0 166.57 0 148.867V32.9723C0 15.2703 14.3504 0.919922 32.0524 0.919922ZM119.562 82.8879H85.0826C82.4732 82.8879 80.3579 85.0032 80.3579 87.6126V94.2348C80.3579 96.8442 82.4732 98.9595 85.0826 98.9595H119.562C122.171 98.9595 124.286 96.8442 124.286 94.2348V87.6126C124.286 85.0032 122.171 82.8879 119.562 82.8879ZM85.0826 49.1346H127.061C129.67 49.1346 131.785 51.2499 131.785 53.8593V60.4815C131.785 63.0909 129.67 65.2062 127.061 65.2062H85.0826C82.4732 65.2062 80.3579 63.0909 80.3579 60.4815V53.8593C80.3579 51.2499 82.4732 49.1346 85.0826 49.1346ZM131.785 127.981V121.358C131.785 118.75 129.669 116.634 127.061 116.634H76.5706C69.7821 116.634 64.2863 111.138 64.2863 104.349V53.8593C64.2863 51.2513 62.1697 49.1346 59.5616 49.1346H52.9395C50.3314 49.1346 48.2147 51.2513 48.2147 53.8593V114.199C48.8497 124.133 56.7873 132.07 66.7205 132.705H127.061C129.669 132.705 131.785 130.589 131.785 127.981Z'
1863+
fill='#316BFF'
1864+
/>
1865+
<path
1866+
d='M85.0826 49.1346H127.061C129.67 49.1346 131.785 51.2499 131.785 53.8593V60.4815C131.785 63.0909 129.67 65.2062 127.061 65.2062H85.0826C82.4732 65.2062 80.3579 63.0909 80.3579 60.4815V53.8593C80.3579 51.2499 82.4732 49.1346 85.0826 49.1346Z'
1867+
fill='white'
1868+
/>
1869+
<path
1870+
d='M85.0826 82.8879H119.562C122.171 82.8879 124.286 85.0032 124.286 87.6126V94.2348C124.286 96.8442 122.171 98.9595 119.562 98.9595H85.0826C82.4732 98.9595 80.3579 96.8442 80.3579 94.2348V87.6126C80.3579 85.0032 82.4732 82.8879 85.0826 82.8879Z'
1871+
fill='white'
1872+
/>
1873+
<path
1874+
d='M131.785 121.358V127.981C131.785 130.589 129.669 132.705 127.061 132.705H66.7205C56.7873 132.07 48.8497 124.133 48.2147 114.199V53.8593C48.2147 51.2513 50.3314 49.1346 52.9395 49.1346H59.5616C62.1697 49.1346 64.2863 51.2513 64.2863 53.8593V104.349C64.2863 111.138 69.7821 116.634 76.5706 116.634H127.061C129.669 116.634 131.785 118.75 131.785 121.358Z'
1875+
fill='white'
1876+
/>
18691877
</svg>
18701878
)
18711879
}

apps/docs/content/docs/en/tools/a2a.mdx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,3 @@ Delete the push notification webhook configuration for a task.
208208
| `success` | boolean | Whether deletion was successful |
209209

210210

211-
212-
## Notes
213-
214-
- Category: `tools`
215-
- Type: `a2a`

apps/docs/content/docs/en/tools/lemlist.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ Retrieves lead information by email address or lead ID.
4949
| Parameter | Type | Required | Description |
5050
| --------- | ---- | -------- | ----------- |
5151
| `apiKey` | string | Yes | Lemlist API key |
52-
| `email` | string | No | Lead email address \(use either email or id\) |
53-
| `id` | string | No | Lead ID \(use either email or id\) |
52+
| `leadIdentifier` | string | Yes | Lead email address or lead ID |
5453

5554
#### Output
5655

apps/docs/content/docs/en/tools/slack.mdx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,45 @@ Read the latest messages from Slack channels. Retrieve conversation history with
124124
| --------- | ---- | ----------- |
125125
| `messages` | array | Array of message objects from the channel |
126126

127+
### `slack_get_message`
128+
129+
Retrieve a specific message by its timestamp. Useful for getting a thread parent message.
130+
131+
#### Input
132+
133+
| Parameter | Type | Required | Description |
134+
| --------- | ---- | -------- | ----------- |
135+
| `authMethod` | string | No | Authentication method: oauth or bot_token |
136+
| `botToken` | string | No | Bot token for Custom Bot |
137+
| `channel` | string | Yes | Slack channel ID \(e.g., C1234567890\) |
138+
| `timestamp` | string | Yes | Message timestamp to retrieve \(e.g., 1405894322.002768\) |
139+
140+
#### Output
141+
142+
| Parameter | Type | Description |
143+
| --------- | ---- | ----------- |
144+
| `message` | object | The retrieved message object |
145+
146+
### `slack_get_thread`
147+
148+
Retrieve an entire thread including the parent message and all replies. Useful for getting full conversation context.
149+
150+
#### Input
151+
152+
| Parameter | Type | Required | Description |
153+
| --------- | ---- | -------- | ----------- |
154+
| `authMethod` | string | No | Authentication method: oauth or bot_token |
155+
| `botToken` | string | No | Bot token for Custom Bot |
156+
| `channel` | string | Yes | Slack channel ID \(e.g., C1234567890\) |
157+
| `threadTs` | string | Yes | Thread timestamp \(thread_ts\) to retrieve \(e.g., 1405894322.002768\) |
158+
| `limit` | number | No | Maximum number of messages to return \(default: 100, max: 200\) |
159+
160+
#### Output
161+
162+
| Parameter | Type | Description |
163+
| --------- | ---- | ----------- |
164+
| `parentMessage` | object | The thread parent message |
165+
127166
### `slack_list_channels`
128167

129168
List all channels in a Slack workspace. Returns public and private channels the bot has access to.

apps/sim/blocks/blocks/slack.ts

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ export const SlackBlock: BlockConfig<SlackResponse> = {
2626
{ label: 'Send Message', id: 'send' },
2727
{ label: 'Create Canvas', id: 'canvas' },
2828
{ label: 'Read Messages', id: 'read' },
29+
{ label: 'Get Message', id: 'get_message' },
30+
{ label: 'Get Thread', id: 'get_thread' },
2931
{ label: 'List Channels', id: 'list_channels' },
3032
{ label: 'List Channel Members', id: 'list_members' },
3133
{ label: 'List Users', id: 'list_users' },
@@ -316,6 +318,68 @@ export const SlackBlock: BlockConfig<SlackResponse> = {
316318
},
317319
required: true,
318320
},
321+
// Get Message specific fields
322+
{
323+
id: 'getMessageTimestamp',
324+
title: 'Message Timestamp',
325+
type: 'short-input',
326+
placeholder: 'Message timestamp (e.g., 1405894322.002768)',
327+
condition: {
328+
field: 'operation',
329+
value: 'get_message',
330+
},
331+
required: true,
332+
wandConfig: {
333+
enabled: true,
334+
prompt: `Extract or generate a Slack message timestamp from the user's input.
335+
Slack message timestamps are in the format: XXXXXXXXXX.XXXXXX (seconds.microseconds since Unix epoch).
336+
Examples:
337+
- "1405894322.002768" -> 1405894322.002768 (already a valid timestamp)
338+
- "thread_ts from the trigger" -> The user wants to reference a variable, output the original text
339+
- A URL like "https://slack.com/archives/C123/p1405894322002768" -> Extract 1405894322.002768 (remove 'p' prefix, add decimal after 10th digit)
340+
341+
If the input looks like a reference to another block's output (contains < and >) or a variable, return it as-is.
342+
Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
343+
placeholder: 'Paste a Slack message URL or timestamp...',
344+
generationType: 'timestamp',
345+
},
346+
},
347+
// Get Thread specific fields
348+
{
349+
id: 'getThreadTimestamp',
350+
title: 'Thread Timestamp',
351+
type: 'short-input',
352+
placeholder: 'Thread timestamp (thread_ts, e.g., 1405894322.002768)',
353+
condition: {
354+
field: 'operation',
355+
value: 'get_thread',
356+
},
357+
required: true,
358+
wandConfig: {
359+
enabled: true,
360+
prompt: `Extract or generate a Slack thread timestamp from the user's input.
361+
Slack thread timestamps (thread_ts) are in the format: XXXXXXXXXX.XXXXXX (seconds.microseconds since Unix epoch).
362+
Examples:
363+
- "1405894322.002768" -> 1405894322.002768 (already a valid timestamp)
364+
- "thread_ts from the trigger" -> The user wants to reference a variable, output the original text
365+
- A URL like "https://slack.com/archives/C123/p1405894322002768" -> Extract 1405894322.002768 (remove 'p' prefix, add decimal after 10th digit)
366+
367+
If the input looks like a reference to another block's output (contains < and >) or a variable, return it as-is.
368+
Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
369+
placeholder: 'Paste a Slack thread URL or thread_ts...',
370+
generationType: 'timestamp',
371+
},
372+
},
373+
{
374+
id: 'threadLimit',
375+
title: 'Message Limit',
376+
type: 'short-input',
377+
placeholder: '100',
378+
condition: {
379+
field: 'operation',
380+
value: 'get_thread',
381+
},
382+
},
319383
{
320384
id: 'oldest',
321385
title: 'Oldest Timestamp',
@@ -430,6 +494,8 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
430494
'slack_message',
431495
'slack_canvas',
432496
'slack_message_reader',
497+
'slack_get_message',
498+
'slack_get_thread',
433499
'slack_list_channels',
434500
'slack_list_members',
435501
'slack_list_users',
@@ -448,6 +514,10 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
448514
return 'slack_canvas'
449515
case 'read':
450516
return 'slack_message_reader'
517+
case 'get_message':
518+
return 'slack_get_message'
519+
case 'get_thread':
520+
return 'slack_get_thread'
451521
case 'list_channels':
452522
return 'slack_list_channels'
453523
case 'list_members':
@@ -498,6 +568,9 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
498568
includeDeleted,
499569
userLimit,
500570
userId,
571+
getMessageTimestamp,
572+
getThreadTimestamp,
573+
threadLimit,
501574
...rest
502575
} = params
503576

@@ -574,6 +647,27 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
574647
break
575648
}
576649

650+
case 'get_message':
651+
if (!getMessageTimestamp) {
652+
throw new Error('Message timestamp is required for get message operation')
653+
}
654+
baseParams.timestamp = getMessageTimestamp
655+
break
656+
657+
case 'get_thread': {
658+
if (!getThreadTimestamp) {
659+
throw new Error('Thread timestamp is required for get thread operation')
660+
}
661+
baseParams.threadTs = getThreadTimestamp
662+
if (threadLimit) {
663+
const parsedLimit = Number.parseInt(threadLimit, 10)
664+
if (!Number.isNaN(parsedLimit) && parsedLimit > 0) {
665+
baseParams.limit = Math.min(parsedLimit, 200)
666+
}
667+
}
668+
break
669+
}
670+
577671
case 'list_channels': {
578672
baseParams.includePrivate = includePrivate !== 'false'
579673
baseParams.excludeArchived = true
@@ -679,6 +773,14 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
679773
userLimit: { type: 'string', description: 'Maximum number of users to return' },
680774
// Get User inputs
681775
userId: { type: 'string', description: 'User ID to look up' },
776+
// Get Message inputs
777+
getMessageTimestamp: { type: 'string', description: 'Message timestamp to retrieve' },
778+
// Get Thread inputs
779+
getThreadTimestamp: { type: 'string', description: 'Thread timestamp to retrieve' },
780+
threadLimit: {
781+
type: 'string',
782+
description: 'Maximum number of messages to return from thread',
783+
},
682784
},
683785
outputs: {
684786
// slack_message outputs (send operation)
@@ -706,6 +808,24 @@ Return ONLY the timestamp string - no explanations, no quotes, no extra text.`,
706808
'Array of message objects with comprehensive properties: text, user, timestamp, reactions, threads, files, attachments, blocks, stars, pins, and edit history',
707809
},
708810

811+
// slack_get_thread outputs (get_thread operation)
812+
parentMessage: {
813+
type: 'json',
814+
description: 'The thread parent message with all properties',
815+
},
816+
replies: {
817+
type: 'json',
818+
description: 'Array of reply messages in the thread (excluding the parent)',
819+
},
820+
replyCount: {
821+
type: 'number',
822+
description: 'Number of replies returned in this response',
823+
},
824+
hasMore: {
825+
type: 'boolean',
826+
description: 'Whether there are more messages in the thread',
827+
},
828+
709829
// slack_list_channels outputs (list_channels operation)
710830
channels: {
711831
type: 'json',

apps/sim/tools/registry.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,8 @@ import {
11801180
slackCanvasTool,
11811181
slackDeleteMessageTool,
11821182
slackDownloadTool,
1183+
slackGetMessageTool,
1184+
slackGetThreadTool,
11831185
slackGetUserTool,
11841186
slackListChannelsTool,
11851187
slackListMembersTool,
@@ -1731,6 +1733,8 @@ export const tools: Record<string, ToolConfig> = {
17311733
slack_list_members: slackListMembersTool,
17321734
slack_list_users: slackListUsersTool,
17331735
slack_get_user: slackGetUserTool,
1736+
slack_get_message: slackGetMessageTool,
1737+
slack_get_thread: slackGetThreadTool,
17341738
slack_canvas: slackCanvasTool,
17351739
slack_download: slackDownloadTool,
17361740
slack_update_message: slackUpdateMessageTool,

0 commit comments

Comments
 (0)