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
26 changes: 24 additions & 2 deletions apps/docs/content/docs/en/tools/agiloft.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="agiloft"
color="#FFFFFF"
color="#001028"
/>

{/* MANUAL-CONTENT-START:intro */}
Expand Down Expand Up @@ -137,6 +137,28 @@ Delete a record from an Agiloft table.
| `id` | string | ID of the deleted record |
| `deleted` | boolean | Whether the record was successfully deleted |

### `agiloft_get_choice_line_id`

Resolve the internal numeric ID of a choice-list value, for use in EWSelect WHERE clauses against choice fields.

#### Input

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `instanceUrl` | string | Yes | Agiloft instance URL \(e.g., https://mycompany.agiloft.com\) |
| `knowledgeBase` | string | Yes | Knowledge base name |
| `login` | string | Yes | Agiloft username |
| `password` | string | Yes | Agiloft password |
| `table` | string | Yes | Table name \(e.g., "case", "contracts"\) |
| `fieldName` | string | Yes | Choice field name \(e.g., "priority", "status"\) |
| `value` | string | Yes | Choice display value to resolve \(e.g., "High", "Active"\) |

#### Output

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `choiceLineId` | number | Internal numeric line ID of the choice value |

### `agiloft_lock_record`

Lock, unlock, or check the lock status of an Agiloft record.
Expand Down Expand Up @@ -254,7 +276,7 @@ List saved searches defined for an Agiloft table.
| `searches` | array | List of saved searches for the table |
| ↳ `name` | string | Saved search name |
| ↳ `label` | string | Saved search display label |
| ↳ `id` | string | Saved search database identifier |
| ↳ `id` | number | Saved search database identifier |
| ↳ `description` | string | Saved search description |

### `agiloft_search_records`
Expand Down
8 changes: 4 additions & 4 deletions apps/docs/content/docs/en/tools/posthog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ List persons (users) in PostHog. Returns user profiles with their properties and

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `personalApiKey` | string | Yes | PostHog Personal API Key \(for authenticated API access\) |
| `apiKey` | string | Yes | PostHog Personal API Key \(for authenticated API access\) |
| `region` | string | No | PostHog region: us \(default\) or eu |
| `projectId` | string | Yes | PostHog Project ID \(e.g., "12345" or project UUID\) |
| `limit` | number | No | Number of persons to return \(default: 100, max: 100\) |
Expand Down Expand Up @@ -115,7 +115,7 @@ Get detailed information about a specific person in PostHog by their ID or UUID.

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `personalApiKey` | string | Yes | PostHog Personal API Key \(for authenticated API access\) |
| `apiKey` | string | Yes | PostHog Personal API Key \(for authenticated API access\) |
| `region` | string | No | PostHog region: us \(default\) or eu |
| `projectId` | string | Yes | PostHog Project ID \(e.g., "12345" or project UUID\) |
| `personId` | string | Yes | Person ID or UUID to retrieve \(e.g., "01234567-89ab-cdef-0123-456789abcdef"\) |
Expand All @@ -139,7 +139,7 @@ Delete a person from PostHog. This will remove all associated events and data. U

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `personalApiKey` | string | Yes | PostHog Personal API Key \(for authenticated API access\) |
| `apiKey` | string | Yes | PostHog Personal API Key \(for authenticated API access\) |
| `region` | string | No | PostHog region: us \(default\) or eu |
| `projectId` | string | Yes | PostHog Project ID \(e.g., "12345" or project UUID\) |
| `personId` | string | Yes | Person ID or UUID to delete \(e.g., "01234567-89ab-cdef-0123-456789abcdef"\) |
Expand All @@ -158,7 +158,7 @@ Execute a HogQL query in PostHog. HogQL is PostHog

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `personalApiKey` | string | Yes | PostHog Personal API Key \(for authenticated API access\) |
| `apiKey` | string | Yes | PostHog Personal API Key \(for authenticated API access\) |
| `region` | string | No | PostHog region: us \(default\) or eu |
| `projectId` | string | Yes | PostHog Project ID \(e.g., "12345" or project UUID\) |
| `query` | string | Yes | HogQL query to execute. Example: \{"kind": "HogQLQuery", "query": "SELECT event, count\(\) FROM events WHERE timestamp &gt; now\(\) - INTERVAL 1 DAY GROUP BY event"\} |
Expand Down
8 changes: 6 additions & 2 deletions apps/sim/app/(landing)/integrations/data/integrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@
"name": "Agiloft",
"description": "Manage records in Agiloft CLM",
"longDescription": "Integrate with Agiloft contract lifecycle management to create, read, update, delete, and search records. Supports file attachments, SQL-based selection, saved searches, and record locking across any table in your knowledge base.",
"bgColor": "#FFFFFF",
"bgColor": "#001028",
"iconName": "AgiloftIcon",
"docsUrl": "https://docs.sim.ai/tools/agiloft",
"operations": [
Expand Down Expand Up @@ -372,9 +372,13 @@
{
"name": "Lock Record",
"description": "Lock, unlock, or check the lock status of an Agiloft record."
},
{
"name": "Get Choice Line ID",
"description": "Resolve the internal numeric ID of a choice-list value, for use in EWSelect WHERE clauses against choice fields."
}
],
"operationCount": 12,
"operationCount": 13,
"triggers": [],
"triggerCount": 0,
"authType": "none",
Expand Down
8 changes: 3 additions & 5 deletions apps/sim/app/api/tools/agiloft/attach/route.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createLogger } from '@sim/logger'
import { toError } from '@sim/utils/errors'
import { type NextRequest, NextResponse } from 'next/server'
import { agiloftAttachContract } from '@/lib/api/contracts/tools/agiloft'
import { getValidationErrorMessage, parseRequest } from '@/lib/api/server'
Expand Down Expand Up @@ -90,7 +91,7 @@ export const POST = withRouteHandler(async (request: NextRequest) => {
const agiloftResponse = await fetch(url, {
method: 'PUT',
headers: {
'Content-Type': userFile.type || 'application/octet-stream',
'Content-Type': 'application/octet-stream',
Authorization: `Bearer ${token}`,
},
body: new Uint8Array(fileBuffer),
Expand Down Expand Up @@ -136,9 +137,6 @@ export const POST = withRouteHandler(async (request: NextRequest) => {
} catch (error) {
logger.error(`[${requestId}] Error attaching file to Agiloft:`, error)

return NextResponse.json(
{ success: false, error: error instanceof Error ? error.message : 'Internal server error' },
{ status: 500 }
)
return NextResponse.json({ success: false, error: toError(error).message }, { status: 500 })
}
})
6 changes: 2 additions & 4 deletions apps/sim/app/api/tools/agiloft/retrieve/route.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createLogger } from '@sim/logger'
import { toError } from '@sim/utils/errors'
import { type NextRequest, NextResponse } from 'next/server'
import { agiloftRetrieveContract } from '@/lib/api/contracts/tools/agiloft'
import { getValidationErrorMessage, parseRequest } from '@/lib/api/server'
Expand Down Expand Up @@ -127,9 +128,6 @@ export const POST = withRouteHandler(async (request: NextRequest) => {
} catch (error) {
logger.error(`[${requestId}] Error retrieving Agiloft attachment:`, error)

return NextResponse.json(
{ success: false, error: error instanceof Error ? error.message : 'Internal server error' },
{ status: 500 }
)
return NextResponse.json({ success: false, error: toError(error).message }, { status: 500 })
}
})
39 changes: 33 additions & 6 deletions apps/sim/blocks/blocks/agiloft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const AgiloftBlock: BlockConfig = {
category: 'tools',
integrationType: IntegrationType.Productivity,
tags: ['automation'],
bgColor: '#FFFFFF',
bgColor: '#001028',
icon: AgiloftIcon,
authMode: AuthMode.ApiKey,

Expand All @@ -35,6 +35,7 @@ export const AgiloftBlock: BlockConfig = {
{ label: 'Remove Attachment', id: 'remove_attachment' },
{ label: 'Attachment Info', id: 'attachment_info' },
{ label: 'Lock Record', id: 'lock_record' },
{ label: 'Get Choice Line ID', id: 'get_choice_line_id' },
],
value: () => 'search_records',
},
Expand All @@ -44,7 +45,6 @@ export const AgiloftBlock: BlockConfig = {
type: 'short-input',
placeholder: 'https://mycompany.agiloft.com',
required: true,
password: false,
},
{
id: 'knowledgeBase',
Expand Down Expand Up @@ -151,16 +151,36 @@ export const AgiloftBlock: BlockConfig = {
id: 'fieldName',
title: 'Field Name',
type: 'short-input',
placeholder: 'e.g., attached_docs',
placeholder: 'e.g., attached_docs, priority',
condition: {
field: 'operation',
value: ['attach_file', 'retrieve_attachment', 'remove_attachment', 'attachment_info'],
value: [
'attach_file',
'retrieve_attachment',
'remove_attachment',
'attachment_info',
'get_choice_line_id',
],
},
required: {
field: 'operation',
value: ['attach_file', 'retrieve_attachment', 'remove_attachment', 'attachment_info'],
value: [
'attach_file',
'retrieve_attachment',
'remove_attachment',
'attachment_info',
'get_choice_line_id',
],
},
},
{
id: 'value',
title: 'Choice Value',
type: 'short-input',
placeholder: 'e.g., High, Active',
condition: { field: 'operation', value: 'get_choice_line_id' },
required: { field: 'operation', value: 'get_choice_line_id' },
},
{
id: 'uploadFile',
title: 'File',
Expand Down Expand Up @@ -254,6 +274,7 @@ export const AgiloftBlock: BlockConfig = {
'agiloft_attachment_info',
'agiloft_create_record',
'agiloft_delete_record',
'agiloft_get_choice_line_id',
'agiloft_lock_record',
'agiloft_read_record',
'agiloft_remove_attachment',
Expand Down Expand Up @@ -288,7 +309,8 @@ export const AgiloftBlock: BlockConfig = {
data: { type: 'string', description: 'Record data as JSON' },
query: { type: 'string', description: 'Search query' },
where: { type: 'string', description: 'SQL WHERE clause for select' },
fieldName: { type: 'string', description: 'Attachment field name' },
fieldName: { type: 'string', description: 'Attachment field name or choice field name' },
value: { type: 'string', description: 'Choice value to resolve to its line ID' },
attachFile: { type: 'file', description: 'File to attach' },
fileName: { type: 'string', description: 'Name for the attached file' },
position: { type: 'string', description: 'Attachment position index' },
Expand Down Expand Up @@ -403,5 +425,10 @@ export const AgiloftBlock: BlockConfig = {
description: 'Minutes until the lock expires',
condition: { field: 'operation', value: 'lock_record' },
},
choiceLineId: {
type: 'number',
description: 'Internal numeric ID of the resolved choice value',
condition: { field: 'operation', value: 'get_choice_line_id' },
},
},
}
4 changes: 2 additions & 2 deletions apps/sim/lib/api/contracts/tools/agiloft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export const agiloftAttachBodySchema = z.object({
table: z.string().min(1, 'Table is required'),
recordId: z.string().min(1, 'Record ID is required'),
fieldName: z.string().min(1, 'Field name is required'),
file: FileInputSchema.optional().nullable(),
fileName: z.string().optional().nullable(),
file: FileInputSchema.optional(),
fileName: z.string().optional(),
})

export const agiloftRetrieveContract = defineRouteContract({
Expand Down
10 changes: 7 additions & 3 deletions apps/sim/tools/agiloft/attachment_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,13 @@ export const agiloftAttachmentInfoTool: ToolConfig<
for (let i = 0; i < result.length; i++) {
const item = result[i] as Record<string, unknown>
attachments.push({
position: (item.position as number) ?? i,
name: (item.name as string) ?? (item.filename as string) ?? '',
size: (item.size as number) ?? 0,
position: (item.filePosition as number) ?? (item.position as number) ?? i,
name:
(item.fileName as string) ??
(item.name as string) ??
(item.filename as string) ??
'',
size: (item.size as number) ?? (item.fileSize as number) ?? 0,
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/sim/tools/agiloft/create_record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const agiloftCreateRecordTool: ToolConfig<AgiloftCreateRecordParams, Agil
(base) => ({
url: buildCreateRecordUrl(base, params),
method: 'POST',
headers: { 'Content-Type': 'application/json' },
headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
body,
}),
async (response) => {
Expand Down
1 change: 1 addition & 0 deletions apps/sim/tools/agiloft/delete_record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const agiloftDeleteRecordTool: ToolConfig<AgiloftDeleteRecordParams, Agil
(base) => ({
url: buildDeleteRecordUrl(base, params),
method: 'DELETE',
headers: { Accept: 'application/json' },
}),
async (response) => {
if (!response.ok) {
Expand Down
Loading
Loading