Skip to content

Commit b7a1e37

Browse files
Adam GoughAdam Gough
authored andcommitted
fixed clay tool
1 parent dba7514 commit b7a1e37

2 files changed

Lines changed: 19 additions & 9 deletions

File tree

apps/sim/blocks/blocks/clay.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@ Plain Text: Best for populating a table in free-form style.
3535
},
3636
{
3737
id: 'authToken',
38-
title: 'Auth Token',
38+
title: 'Auth Token (Optional)',
3939
type: 'short-input',
4040
layout: 'full',
41-
placeholder: 'Enter your Clay Auth token',
41+
placeholder: 'Enter your Clay webhook auth token (optional)',
4242
password: true,
4343
connectionDroppable: false,
44-
required: true,
44+
required: false,
45+
description:
46+
'Optional: If your Clay table has webhook authentication enabled, enter the auth token here. This will be sent in the x-clay-webhook-auth header.',
4547
},
4648
],
4749
tools: {

apps/sim/tools/clay/populate.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,27 @@ export const clayPopulateTool: ToolConfig<ClayPopulateParams, ClayPopulateRespon
2323
},
2424
authToken: {
2525
type: 'string',
26-
required: true,
26+
required: false,
2727
visibility: 'user-only',
28-
description: 'Auth token for Clay webhook authentication',
28+
description:
29+
'Optional auth token for Clay webhook authentication (most webhooks do not require this)',
2930
},
3031
},
3132

3233
request: {
3334
url: (params: ClayPopulateParams) => params.webhookURL,
3435
method: 'POST',
35-
headers: (params: ClayPopulateParams) => ({
36-
'Content-Type': 'application/json',
37-
Authorization: `Bearer ${params.authToken}`,
38-
}),
36+
headers: (params: ClayPopulateParams) => {
37+
const headers: Record<string, string> = {
38+
'Content-Type': 'application/json',
39+
}
40+
41+
if (params.authToken && params.authToken.trim() !== '') {
42+
headers['x-clay-webhook-auth'] = params.authToken
43+
}
44+
45+
return headers
46+
},
3947
body: (params: ClayPopulateParams) => ({
4048
data: params.data,
4149
}),

0 commit comments

Comments
 (0)