Skip to content

Commit 65ddd74

Browse files
committed
fix(outlook): allow clearing message categories by passing an empty array
An explicit empty array now sends categories:[] to clear all labels, a non-empty value replaces, and an absent/empty value leaves them untouched — matching the documented replace semantics.
1 parent 1aaa094 commit 65ddd74

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

apps/docs/content/docs/en/integrations/outlook.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ Set the categories, follow-up flag, and importance on an Outlook message
337337
| Parameter | Type | Required | Description |
338338
| --------- | ---- | -------- | ----------- |
339339
| `messageId` | string | Yes | The ID of the message to update |
340-
| `categories` | json | No | Array of category names to assign to the message \(replaces existing categories\) |
340+
| `categories` | json | No | Array of category names to assign to the message \(replaces existing categories; pass an empty array to clear all\) |
341341
| `flagStatus` | string | No | Follow-up flag status: notFlagged, flagged, or complete |
342342
| `importance` | string | No | Message importance: low, normal, or high |
343343

apps/sim/tools/outlook/update_message.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const outlookUpdateMessageTool: ToolConfig<
6666
required: false,
6767
visibility: 'user-or-llm',
6868
description:
69-
'Array of category names to assign to the message (replaces existing categories)',
69+
'Array of category names to assign to the message (replaces existing categories; pass an empty array to clear all)',
7070
},
7171
flagStatus: {
7272
type: 'string',
@@ -97,9 +97,11 @@ export const outlookUpdateMessageTool: ToolConfig<
9797
body: (params) => {
9898
const body: Record<string, unknown> = {}
9999

100-
const categories = normalizeCategories(params.categories)
101-
if (categories.length > 0) {
102-
body.categories = categories
100+
const rawCategories: unknown = params.categories
101+
if (Array.isArray(rawCategories)) {
102+
body.categories = normalizeCategories(rawCategories)
103+
} else if (typeof rawCategories === 'string' && rawCategories.trim() !== '') {
104+
body.categories = normalizeCategories(rawCategories)
103105
}
104106

105107
if (params.flagStatus) {

0 commit comments

Comments
 (0)