Skip to content

Commit 99b1702

Browse files
fix(slack): accept scalar checkbox values in List responses (#8236)
1 parent ad66fdf commit 99b1702

5 files changed

Lines changed: 39 additions & 8 deletions

File tree

‎apps/docs/content/docs/integrations/slack.mdx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,7 @@ Read a page of Slack List rows and optionally its column schema. Pass nextCursor
15801580
| ↳ `user` | array | Slack user IDs |
15811581
| ↳ `channel` | array | Slack channel IDs |
15821582
| ↳ `attachment` | array | Slack file IDs |
1583-
| ↳ `checkbox` | array | Checkbox values in responses; write a scalar boolean |
1583+
| ↳ `checkbox` | json | Checkbox boolean or boolean array returned by Slack; write a scalar boolean |
15841584
| ↳ `email` | array | Email values |
15851585
| ↳ `phone` | array | Phone values |
15861586
| ↳ `rating` | array | Rating values |
@@ -1635,7 +1635,7 @@ Read a Slack List row and its parent List column schema.
16351635
| ↳ `user` | array | Slack user IDs |
16361636
| ↳ `channel` | array | Slack channel IDs |
16371637
| ↳ `attachment` | array | Slack file IDs |
1638-
| ↳ `checkbox` | array | Checkbox values in responses; write a scalar boolean |
1638+
| ↳ `checkbox` | json | Checkbox boolean or boolean array returned by Slack; write a scalar boolean |
16391639
| ↳ `email` | array | Email values |
16401640
| ↳ `phone` | array | Phone values |
16411641
| ↳ `rating` | array | Rating values |
@@ -1691,7 +1691,7 @@ Create a Slack List row using real column IDs and typed cell values. Text column
16911691
| ↳ `user` | array | Slack user IDs |
16921692
| ↳ `channel` | array | Slack channel IDs |
16931693
| ↳ `attachment` | array | Slack file IDs |
1694-
| ↳ `checkbox` | array | Checkbox values in responses; write a scalar boolean |
1694+
| ↳ `checkbox` | json | Checkbox boolean or boolean array returned by Slack; write a scalar boolean |
16951695
| ↳ `email` | array | Email values |
16961696
| ↳ `phone` | array | Phone values |
16971697
| ↳ `rating` | array | Rating values |

‎apps/sim/tools/generated/tool-outputs.ts‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎apps/sim/tools/slack_lists/operations.test.ts‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,37 @@ describe('Slack Lists responses', () => {
242242
)
243243
expect(empty.output.list?.schema).toEqual(schema)
244244
})
245+
it.each([false, true, [false], [true]])(
246+
'preserves checkbox response %j across row operations',
247+
async (checkbox) => {
248+
const row = {
249+
...item,
250+
fields: [{ column_id: 'Col1', key: 'done', value: false, checkbox }],
251+
}
252+
const created = await slackListsItemsCreateTool.transformResponse!(
253+
Response.json({ ok: true, item: row })
254+
)
255+
const page = await slackListsItemsListTool.transformResponse!(
256+
Response.json({ ok: true, items: [row], list })
257+
)
258+
const info = await slackListsItemsInfoTool.transformResponse!(
259+
Response.json({ ok: true, record: row, list })
260+
)
261+
expect(created.output.item.fields).toEqual(row.fields)
262+
expect(page.output.items[0].fields).toEqual(row.fields)
263+
expect(info.output.item.fields).toEqual(row.fields)
264+
}
265+
)
266+
it.each([null, 'false', 0, ['false']])(
267+
'rejects malformed checkbox response %j',
268+
async (checkbox) => {
269+
await expect(
270+
slackListsItemsCreateTool.transformResponse!(
271+
Response.json({ ok: true, item: { ...item, fields: [{ column_id: 'Col1', checkbox }] } })
272+
)
273+
).rejects.toThrow()
274+
}
275+
)
245276
it('reads items.info from record, and items.create from item', async () => {
246277
expect(
247278
(

‎apps/sim/tools/slack_lists/types.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ export const LIST_ITEM_OUTPUT_PROPERTIES = {
161161
items: { type: 'string' },
162162
},
163163
checkbox: {
164-
type: 'array',
164+
type: 'json',
165165
optional: true,
166-
description: 'Checkbox values in responses; write a scalar boolean',
167-
items: { type: 'boolean' },
166+
description:
167+
'Checkbox boolean or boolean array returned by Slack; write a scalar boolean',
168168
},
169169
email: {
170170
type: 'array',

‎apps/sim/tools/slack_lists/utils.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const listFieldResponseSchema = z
1919
user: z.array(z.string()).optional(),
2020
channel: z.array(z.string()).optional(),
2121
attachment: z.array(z.string()).optional(),
22-
checkbox: z.array(z.boolean()).optional(),
22+
checkbox: z.union([z.boolean(), z.array(z.boolean())]).optional(),
2323
email: z.array(z.string()).optional(),
2424
phone: z.array(z.string()).optional(),
2525
rating: z.array(z.number()).optional(),

0 commit comments

Comments
 (0)