Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/docs/content/docs/en/tools/clay.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,14 @@ Populate Clay with data from a JSON file. Enables direct communication and notif
| --------- | ---- | -------- | ----------- |
| `webhookURL` | string | Yes | The webhook URL to populate |
| `data` | json | Yes | The data to populate |
| `authToken` | string | Yes | Auth token for Clay webhook authentication |
| `authToken` | string | No | Optional auth token for Clay webhook authentication \(most webhooks do not require this\) |

#### Output

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `success` | boolean | Operation success status |
| `output` | json | Clay populate operation results including response data from Clay webhook |
| `data` | json | Response data from Clay webhook |
| `metadata` | object | Webhook response metadata |



Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/en/tools/discord.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { BlockInfoCard } from "@/components/ui/block-info-card"

<BlockInfoCard
type="discord"
color="#E0E0E0"
color="#5865F2"
icon={true}
iconSvg={`<svg className="block-icon"

Expand Down
2 changes: 2 additions & 0 deletions apps/docs/content/docs/en/tools/qdrant.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ Search for similar vectors in a Qdrant collection
| `vector` | array | Yes | Vector to search for |
| `limit` | number | No | Number of results to return |
| `filter` | object | No | Filter to apply to the search |
| `search_return_data` | string | No | Data to return from search |
| `with_payload` | boolean | No | Include payload in response |
| `with_vector` | boolean | No | Include vector in response |

Expand All @@ -165,6 +166,7 @@ Fetch points by ID from a Qdrant collection
| `apiKey` | string | No | Qdrant API key \(optional\) |
| `collection` | string | Yes | Collection name |
| `ids` | array | Yes | Array of point IDs to fetch |
| `fetch_return_data` | string | No | Data to return from fetch |
| `with_payload` | boolean | No | Include payload in response |
| `with_vector` | boolean | No | Include vector in response |

Expand Down
12 changes: 9 additions & 3 deletions apps/sim/blocks/blocks/clay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ Plain Text: Best for populating a table in free-form style.
title: 'Auth Token',
type: 'short-input',
layout: 'full',
placeholder: 'Enter your Clay Auth token',
placeholder: 'Enter your Clay webhook auth token',
password: true,
connectionDroppable: false,
required: true,
required: false,
description:
'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.',
},
],
tools: {
Expand All @@ -53,6 +55,10 @@ Plain Text: Best for populating a table in free-form style.
data: { type: 'json', description: 'Data to populate' },
},
outputs: {
data: { type: 'json', description: 'Response data' },
data: { type: 'json', description: 'Response data from Clay webhook' },
metadata: {
type: 'json',
description: 'Webhook metadata including status, headers, timestamp, and content type',
},
},
}
59 changes: 46 additions & 13 deletions apps/sim/tools/clay/populate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,47 +23,80 @@ export const clayPopulateTool: ToolConfig<ClayPopulateParams, ClayPopulateRespon
},
authToken: {
type: 'string',
required: true,
required: false,
visibility: 'user-only',
description: 'Auth token for Clay webhook authentication',
description:
'Optional auth token for Clay webhook authentication (most webhooks do not require this)',
},
},

request: {
url: (params: ClayPopulateParams) => params.webhookURL,
method: 'POST',
headers: (params: ClayPopulateParams) => ({
'Content-Type': 'application/json',
Authorization: `Bearer ${params.authToken}`,
}),
headers: (params: ClayPopulateParams) => {
const headers: Record<string, string> = {
'Content-Type': 'application/json',
}

if (params.authToken && params.authToken.trim() !== '') {
headers['x-clay-webhook-auth'] = params.authToken
}

return headers
},
body: (params: ClayPopulateParams) => ({
data: params.data,
}),
},

transformResponse: async (response: Response) => {
const contentType = response.headers.get('content-type')
let data
const timestamp = new Date().toISOString()

// Extract response headers
const headers: Record<string, string> = {}
response.headers.forEach((value, key) => {
headers[key] = value
})

// Parse response body
let responseData
if (contentType?.includes('application/json')) {
data = await response.json()
responseData = await response.json()
} else {
data = await response.text()
responseData = await response.text()
}

return {
success: true,
output: {
data: contentType?.includes('application/json') ? data : { message: data },
data: contentType?.includes('application/json') ? responseData : { message: responseData },
metadata: {
status: response.status,
statusText: response.statusText,
headers: headers,
timestamp: timestamp,
contentType: contentType || 'unknown',
},
},
}
},

outputs: {
success: { type: 'boolean', description: 'Operation success status' },
output: {
data: {
type: 'json',
description: 'Clay populate operation results including response data from Clay webhook',
description: 'Response data from Clay webhook',
},
metadata: {
type: 'object',
description: 'Webhook response metadata',
properties: {
status: { type: 'number', description: 'HTTP status code' },
statusText: { type: 'string', description: 'HTTP status text' },
headers: { type: 'object', description: 'Response headers from Clay' },
timestamp: { type: 'string', description: 'ISO timestamp when webhook was received' },
contentType: { type: 'string', description: 'Content type of the response' },
},
},
},
}
7 changes: 7 additions & 0 deletions apps/sim/tools/clay/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,12 @@ export interface ClayPopulateParams {
export interface ClayPopulateResponse extends ToolResponse {
output: {
data: any
metadata: {
status: number
statusText: string
headers: Record<string, string>
timestamp: string
contentType: string
}
}
}