mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-05 05:04:10 -05:00
feat(intercom): added additional params to intercom tools (#2523)
This commit is contained in:
@@ -41,6 +41,7 @@ Create a new contact in Intercom with email, external_id, or role
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `role` | string | No | The role of the contact. Accepts 'user' or 'lead'. Defaults to 'lead' if not specified. |
|
||||
| `email` | string | No | The contact's email address |
|
||||
| `external_id` | string | No | A unique identifier for the contact provided by the client |
|
||||
| `phone` | string | No | The contact's phone number |
|
||||
@@ -51,6 +52,7 @@ Create a new contact in Intercom with email, external_id, or role
|
||||
| `owner_id` | string | No | The id of an admin that has been assigned account ownership of the contact |
|
||||
| `unsubscribed_from_emails` | boolean | No | Whether the contact is unsubscribed from emails |
|
||||
| `custom_attributes` | string | No | Custom attributes as JSON object \(e.g., \{"attribute_name": "value"\}\) |
|
||||
| `company_id` | string | No | Company ID to associate the contact with during creation |
|
||||
|
||||
#### Output
|
||||
|
||||
@@ -85,6 +87,8 @@ Update an existing contact in Intercom
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `contactId` | string | Yes | Contact ID to update |
|
||||
| `role` | string | No | The role of the contact. Accepts 'user' or 'lead'. |
|
||||
| `external_id` | string | No | A unique identifier for the contact provided by the client |
|
||||
| `email` | string | No | The contact's email address |
|
||||
| `phone` | string | No | The contact's phone number |
|
||||
| `name` | string | No | The contact's name |
|
||||
@@ -94,6 +98,7 @@ Update an existing contact in Intercom
|
||||
| `owner_id` | string | No | The id of an admin that has been assigned account ownership of the contact |
|
||||
| `unsubscribed_from_emails` | boolean | No | Whether the contact is unsubscribed from emails |
|
||||
| `custom_attributes` | string | No | Custom attributes as JSON object \(e.g., \{"attribute_name": "value"\}\) |
|
||||
| `company_id` | string | No | Company ID to associate the contact with |
|
||||
|
||||
#### Output
|
||||
|
||||
@@ -131,6 +136,8 @@ Search for contacts in Intercom using a query
|
||||
| `query` | string | Yes | Search query \(e.g., \{"field":"email","operator":"=","value":"user@example.com"\}\) |
|
||||
| `per_page` | number | No | Number of results per page \(max: 150\) |
|
||||
| `starting_after` | string | No | Cursor for pagination |
|
||||
| `sort_field` | string | No | Field to sort by \(e.g., "name", "created_at", "last_seen_at"\) |
|
||||
| `sort_order` | string | No | Sort order: "ascending" or "descending" |
|
||||
|
||||
#### Output
|
||||
|
||||
@@ -172,6 +179,7 @@ Create or update a company in Intercom
|
||||
| `industry` | string | No | The industry the company operates in |
|
||||
| `monthly_spend` | number | No | How much revenue the company generates for your business. Note: This field truncates floats to whole integers \(e.g., 155.98 becomes 155\) |
|
||||
| `custom_attributes` | string | No | Custom attributes as JSON object |
|
||||
| `remote_created_at` | number | No | The time the company was created by you as a Unix timestamp |
|
||||
|
||||
#### Output
|
||||
|
||||
@@ -207,6 +215,7 @@ List all companies from Intercom with pagination support. Note: This endpoint ha
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `per_page` | number | No | Number of results per page |
|
||||
| `page` | number | No | Page number |
|
||||
| `starting_after` | string | No | Cursor for pagination \(preferred over page-based pagination\) |
|
||||
|
||||
#### Output
|
||||
|
||||
@@ -225,6 +234,7 @@ Retrieve a single conversation by ID from Intercom
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `conversationId` | string | Yes | Conversation ID to retrieve |
|
||||
| `display_as` | string | No | Set to "plaintext" to retrieve messages in plain text |
|
||||
| `include_translations` | boolean | No | When true, conversation parts will be translated to the detected language of the conversation |
|
||||
|
||||
#### Output
|
||||
|
||||
@@ -243,6 +253,8 @@ List all conversations from Intercom with pagination support
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `per_page` | number | No | Number of results per page \(max: 150\) |
|
||||
| `starting_after` | string | No | Cursor for pagination |
|
||||
| `sort` | string | No | Field to sort by \(e.g., "waiting_since", "updated_at", "created_at"\) |
|
||||
| `order` | string | No | Sort order: "asc" \(ascending\) or "desc" \(descending\) |
|
||||
|
||||
#### Output
|
||||
|
||||
@@ -264,6 +276,7 @@ Reply to a conversation as an admin in Intercom
|
||||
| `body` | string | Yes | The text body of the reply |
|
||||
| `admin_id` | string | No | The ID of the admin authoring the reply. If not provided, a default admin \(Operator/Fin\) will be used. |
|
||||
| `attachment_urls` | string | No | Comma-separated list of image URLs \(max 10\) |
|
||||
| `created_at` | number | No | Unix timestamp for when the reply was created. If not provided, current time is used. |
|
||||
|
||||
#### Output
|
||||
|
||||
@@ -283,6 +296,8 @@ Search for conversations in Intercom using a query
|
||||
| `query` | string | Yes | Search query as JSON object |
|
||||
| `per_page` | number | No | Number of results per page \(max: 150\) |
|
||||
| `starting_after` | string | No | Cursor for pagination |
|
||||
| `sort_field` | string | No | Field to sort by \(e.g., "created_at", "updated_at"\) |
|
||||
| `sort_order` | string | No | Sort order: "ascending" or "descending" |
|
||||
|
||||
#### Output
|
||||
|
||||
@@ -302,6 +317,10 @@ Create a new ticket in Intercom
|
||||
| `ticket_type_id` | string | Yes | The ID of the ticket type |
|
||||
| `contacts` | string | Yes | JSON array of contact identifiers \(e.g., \[\{"id": "contact_id"\}\]\) |
|
||||
| `ticket_attributes` | string | Yes | JSON object with ticket attributes including _default_title_ and _default_description_ |
|
||||
| `company_id` | string | No | Company ID to associate the ticket with |
|
||||
| `created_at` | number | No | Unix timestamp for when the ticket was created. If not provided, current time is used. |
|
||||
| `conversation_to_link_id` | string | No | ID of an existing conversation to link to this ticket |
|
||||
| `disable_notifications` | boolean | No | When true, suppresses notifications when the ticket is created |
|
||||
|
||||
#### Output
|
||||
|
||||
@@ -335,13 +354,15 @@ Create and send a new admin-initiated message in Intercom
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `message_type` | string | Yes | Message type: "inapp" or "email" |
|
||||
| `message_type` | string | Yes | Message type: "inapp" for in-app messages or "email" for email messages |
|
||||
| `template` | string | Yes | Message template style: "plain" for plain text or "personal" for personalized style |
|
||||
| `subject` | string | No | The subject of the message \(for email type\) |
|
||||
| `body` | string | Yes | The body of the message |
|
||||
| `from_type` | string | Yes | Sender type: "admin" |
|
||||
| `from_id` | string | Yes | The ID of the admin sending the message |
|
||||
| `to_type` | string | Yes | Recipient type: "contact" |
|
||||
| `to_id` | string | Yes | The ID of the contact receiving the message |
|
||||
| `created_at` | number | No | Unix timestamp for when the message was created. If not provided, current time is used. |
|
||||
|
||||
#### Output
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ Query data from a Supabase table
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `projectId` | string | Yes | Your Supabase project ID \(e.g., jdrkgepadsdopsntdlom\) |
|
||||
| `table` | string | Yes | The name of the Supabase table to query |
|
||||
| `schema` | string | No | Database schema to query from \(default: public\). Use this to access tables in other schemas. |
|
||||
| `filter` | string | No | PostgREST filter \(e.g., "id=eq.123"\) |
|
||||
| `orderBy` | string | No | Column to order by \(add DESC for descending\) |
|
||||
| `limit` | number | No | Maximum number of rows to return |
|
||||
@@ -74,6 +75,7 @@ Insert data into a Supabase table
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `projectId` | string | Yes | Your Supabase project ID \(e.g., jdrkgepadsdopsntdlom\) |
|
||||
| `table` | string | Yes | The name of the Supabase table to insert data into |
|
||||
| `schema` | string | No | Database schema to insert into \(default: public\). Use this to access tables in other schemas. |
|
||||
| `data` | array | Yes | The data to insert \(array of objects or a single object\) |
|
||||
| `apiKey` | string | Yes | Your Supabase service role secret key |
|
||||
|
||||
@@ -94,6 +96,7 @@ Get a single row from a Supabase table based on filter criteria
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `projectId` | string | Yes | Your Supabase project ID \(e.g., jdrkgepadsdopsntdlom\) |
|
||||
| `table` | string | Yes | The name of the Supabase table to query |
|
||||
| `schema` | string | No | Database schema to query from \(default: public\). Use this to access tables in other schemas. |
|
||||
| `filter` | string | Yes | PostgREST filter to find the specific row \(e.g., "id=eq.123"\) |
|
||||
| `apiKey` | string | Yes | Your Supabase service role secret key |
|
||||
|
||||
@@ -114,6 +117,7 @@ Update rows in a Supabase table based on filter criteria
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `projectId` | string | Yes | Your Supabase project ID \(e.g., jdrkgepadsdopsntdlom\) |
|
||||
| `table` | string | Yes | The name of the Supabase table to update |
|
||||
| `schema` | string | No | Database schema to update in \(default: public\). Use this to access tables in other schemas. |
|
||||
| `filter` | string | Yes | PostgREST filter to identify rows to update \(e.g., "id=eq.123"\) |
|
||||
| `data` | object | Yes | Data to update in the matching rows |
|
||||
| `apiKey` | string | Yes | Your Supabase service role secret key |
|
||||
@@ -135,6 +139,7 @@ Delete rows from a Supabase table based on filter criteria
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `projectId` | string | Yes | Your Supabase project ID \(e.g., jdrkgepadsdopsntdlom\) |
|
||||
| `table` | string | Yes | The name of the Supabase table to delete from |
|
||||
| `schema` | string | No | Database schema to delete from \(default: public\). Use this to access tables in other schemas. |
|
||||
| `filter` | string | Yes | PostgREST filter to identify rows to delete \(e.g., "id=eq.123"\) |
|
||||
| `apiKey` | string | Yes | Your Supabase service role secret key |
|
||||
|
||||
@@ -155,6 +160,7 @@ Insert or update data in a Supabase table (upsert operation)
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `projectId` | string | Yes | Your Supabase project ID \(e.g., jdrkgepadsdopsntdlom\) |
|
||||
| `table` | string | Yes | The name of the Supabase table to upsert data into |
|
||||
| `schema` | string | No | Database schema to upsert into \(default: public\). Use this to access tables in other schemas. |
|
||||
| `data` | array | Yes | The data to upsert \(insert or update\) - array of objects or a single object |
|
||||
| `apiKey` | string | Yes | Your Supabase service role secret key |
|
||||
|
||||
@@ -175,6 +181,7 @@ Count rows in a Supabase table
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `projectId` | string | Yes | Your Supabase project ID \(e.g., jdrkgepadsdopsntdlom\) |
|
||||
| `table` | string | Yes | The name of the Supabase table to count rows from |
|
||||
| `schema` | string | No | Database schema to count from \(default: public\). Use this to access tables in other schemas. |
|
||||
| `filter` | string | No | PostgREST filter \(e.g., "status=eq.active"\) |
|
||||
| `countType` | string | No | Count type: exact, planned, or estimated \(default: exact\) |
|
||||
| `apiKey` | string | Yes | Your Supabase service role secret key |
|
||||
@@ -196,6 +203,7 @@ Perform full-text search on a Supabase table
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `projectId` | string | Yes | Your Supabase project ID \(e.g., jdrkgepadsdopsntdlom\) |
|
||||
| `table` | string | Yes | The name of the Supabase table to search |
|
||||
| `schema` | string | No | Database schema to search in \(default: public\). Use this to access tables in other schemas. |
|
||||
| `column` | string | Yes | The column to search in |
|
||||
| `query` | string | Yes | The search query |
|
||||
| `searchType` | string | No | Search type: plain, phrase, or websearch \(default: websearch\) |
|
||||
|
||||
@@ -47,6 +47,19 @@ export const IntercomBlock: BlockConfig = {
|
||||
required: true,
|
||||
},
|
||||
// Contact fields
|
||||
{
|
||||
id: 'role',
|
||||
title: 'Role',
|
||||
type: 'dropdown',
|
||||
options: [
|
||||
{ label: 'Lead', id: 'lead' },
|
||||
{ label: 'User', id: 'user' },
|
||||
],
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['create_contact', 'update_contact'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'contactId',
|
||||
title: 'Contact ID',
|
||||
@@ -75,7 +88,7 @@ export const IntercomBlock: BlockConfig = {
|
||||
placeholder: 'External identifier for the contact',
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['create_contact'],
|
||||
value: ['create_contact', 'update_contact'],
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -161,6 +174,16 @@ export const IntercomBlock: BlockConfig = {
|
||||
value: ['create_contact', 'update_contact'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'contact_company_id',
|
||||
title: 'Company ID',
|
||||
type: 'short-input',
|
||||
placeholder: 'Company ID to associate with contact',
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['create_contact', 'update_contact'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'query',
|
||||
title: 'Search Query',
|
||||
@@ -172,6 +195,29 @@ export const IntercomBlock: BlockConfig = {
|
||||
value: ['search_contacts', 'search_conversations'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'sort_field',
|
||||
title: 'Sort Field',
|
||||
type: 'short-input',
|
||||
placeholder: 'Field to sort by (e.g., name, created_at)',
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['search_contacts', 'search_conversations'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'sort_order',
|
||||
title: 'Sort Order',
|
||||
type: 'dropdown',
|
||||
options: [
|
||||
{ label: 'Descending', id: 'descending' },
|
||||
{ label: 'Ascending', id: 'ascending' },
|
||||
],
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['search_contacts', 'search_conversations'],
|
||||
},
|
||||
},
|
||||
// Company fields
|
||||
{
|
||||
id: 'companyId',
|
||||
@@ -255,6 +301,16 @@ export const IntercomBlock: BlockConfig = {
|
||||
value: ['create_company'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'remote_created_at',
|
||||
title: 'Remote Created At',
|
||||
type: 'short-input',
|
||||
placeholder: 'Unix timestamp when company was created',
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['create_company'],
|
||||
},
|
||||
},
|
||||
// Conversation fields
|
||||
{
|
||||
id: 'conversationId',
|
||||
@@ -280,6 +336,42 @@ export const IntercomBlock: BlockConfig = {
|
||||
value: ['get_conversation'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'include_translations',
|
||||
title: 'Include Translations',
|
||||
type: 'dropdown',
|
||||
options: [
|
||||
{ label: 'False', id: 'false' },
|
||||
{ label: 'True', id: 'true' },
|
||||
],
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['get_conversation'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'sort',
|
||||
title: 'Sort By',
|
||||
type: 'short-input',
|
||||
placeholder: 'Field to sort by (e.g., waiting_since, updated_at)',
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['list_conversations'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'order',
|
||||
title: 'Order',
|
||||
type: 'dropdown',
|
||||
options: [
|
||||
{ label: 'Descending', id: 'desc' },
|
||||
{ label: 'Ascending', id: 'asc' },
|
||||
],
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['list_conversations'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'message_type',
|
||||
title: 'Message Type',
|
||||
@@ -326,6 +418,16 @@ export const IntercomBlock: BlockConfig = {
|
||||
value: ['reply_conversation'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'reply_created_at',
|
||||
title: 'Created At',
|
||||
type: 'short-input',
|
||||
placeholder: 'Unix timestamp for reply creation time',
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['reply_conversation'],
|
||||
},
|
||||
},
|
||||
// Ticket fields
|
||||
{
|
||||
id: 'ticketId',
|
||||
@@ -371,6 +473,49 @@ export const IntercomBlock: BlockConfig = {
|
||||
value: ['create_ticket'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'ticket_company_id',
|
||||
title: 'Company ID',
|
||||
type: 'short-input',
|
||||
placeholder: 'Company ID to associate with ticket',
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['create_ticket'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'ticket_created_at',
|
||||
title: 'Created At',
|
||||
type: 'short-input',
|
||||
placeholder: 'Unix timestamp for ticket creation time',
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['create_ticket'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'conversation_to_link_id',
|
||||
title: 'Conversation to Link',
|
||||
type: 'short-input',
|
||||
placeholder: 'ID of conversation to link to ticket',
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['create_ticket'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'disable_notifications',
|
||||
title: 'Disable Notifications',
|
||||
type: 'dropdown',
|
||||
options: [
|
||||
{ label: 'False', id: 'false' },
|
||||
{ label: 'True', id: 'true' },
|
||||
],
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['create_ticket'],
|
||||
},
|
||||
},
|
||||
// Message fields
|
||||
{
|
||||
id: 'message_type_msg',
|
||||
@@ -386,6 +531,20 @@ export const IntercomBlock: BlockConfig = {
|
||||
value: ['create_message'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'template',
|
||||
title: 'Template',
|
||||
type: 'dropdown',
|
||||
options: [
|
||||
{ label: 'Plain', id: 'plain' },
|
||||
{ label: 'Personal', id: 'personal' },
|
||||
],
|
||||
required: true,
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['create_message'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'subject',
|
||||
title: 'Subject',
|
||||
@@ -440,6 +599,16 @@ export const IntercomBlock: BlockConfig = {
|
||||
value: ['create_message'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'message_created_at',
|
||||
title: 'Created At',
|
||||
type: 'short-input',
|
||||
placeholder: 'Unix timestamp for message creation time',
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['create_message'],
|
||||
},
|
||||
},
|
||||
// Pagination fields
|
||||
{
|
||||
id: 'per_page',
|
||||
@@ -464,7 +633,13 @@ export const IntercomBlock: BlockConfig = {
|
||||
placeholder: 'Cursor for pagination',
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['list_contacts', 'search_contacts', 'list_conversations', 'search_conversations'],
|
||||
value: [
|
||||
'list_contacts',
|
||||
'search_contacts',
|
||||
'list_companies',
|
||||
'list_conversations',
|
||||
'search_conversations',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -537,7 +712,19 @@ export const IntercomBlock: BlockConfig = {
|
||||
}
|
||||
},
|
||||
params: (params) => {
|
||||
const { operation, message_type_msg, company_name, ...rest } = params
|
||||
const {
|
||||
operation,
|
||||
message_type_msg,
|
||||
company_name,
|
||||
contact_company_id,
|
||||
reply_created_at,
|
||||
ticket_company_id,
|
||||
ticket_created_at,
|
||||
message_created_at,
|
||||
include_translations,
|
||||
disable_notifications,
|
||||
...rest
|
||||
} = params
|
||||
const cleanParams: Record<string, any> = {}
|
||||
|
||||
// Special mapping for message_type in create_message
|
||||
@@ -550,6 +737,42 @@ export const IntercomBlock: BlockConfig = {
|
||||
cleanParams.name = company_name
|
||||
}
|
||||
|
||||
// Map contact_company_id to company_id for contact operations
|
||||
if (
|
||||
(operation === 'create_contact' || operation === 'update_contact') &&
|
||||
contact_company_id
|
||||
) {
|
||||
cleanParams.company_id = contact_company_id
|
||||
}
|
||||
|
||||
// Map reply_created_at to created_at for reply_conversation
|
||||
if (operation === 'reply_conversation' && reply_created_at) {
|
||||
cleanParams.created_at = Number(reply_created_at)
|
||||
}
|
||||
|
||||
// Map ticket fields
|
||||
if (operation === 'create_ticket') {
|
||||
if (ticket_company_id) cleanParams.company_id = ticket_company_id
|
||||
if (ticket_created_at) cleanParams.created_at = Number(ticket_created_at)
|
||||
if (disable_notifications !== undefined && disable_notifications !== '') {
|
||||
cleanParams.disable_notifications = disable_notifications === 'true'
|
||||
}
|
||||
}
|
||||
|
||||
// Map message_created_at to created_at for create_message
|
||||
if (operation === 'create_message' && message_created_at) {
|
||||
cleanParams.created_at = Number(message_created_at)
|
||||
}
|
||||
|
||||
// Convert include_translations string to boolean for get_conversation
|
||||
if (
|
||||
operation === 'get_conversation' &&
|
||||
include_translations !== undefined &&
|
||||
include_translations !== ''
|
||||
) {
|
||||
cleanParams.include_translations = include_translations === 'true'
|
||||
}
|
||||
|
||||
Object.entries(rest).forEach(([key, value]) => {
|
||||
if (value !== undefined && value !== null && value !== '') {
|
||||
cleanParams[key] = value
|
||||
|
||||
@@ -14,6 +14,7 @@ export interface IntercomCreateCompanyParams {
|
||||
industry?: string
|
||||
monthly_spend?: number
|
||||
custom_attributes?: string
|
||||
remote_created_at?: number
|
||||
}
|
||||
|
||||
export interface IntercomCreateCompanyResponse {
|
||||
@@ -47,52 +48,58 @@ export const intercomCreateCompanyTool: ToolConfig<
|
||||
company_id: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Your unique identifier for the company',
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The name of the company',
|
||||
},
|
||||
website: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The company website',
|
||||
},
|
||||
plan: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The company plan name',
|
||||
},
|
||||
size: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The number of employees in the company',
|
||||
},
|
||||
industry: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The industry the company operates in',
|
||||
},
|
||||
monthly_spend: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'How much revenue the company generates for your business. Note: This field truncates floats to whole integers (e.g., 155.98 becomes 155)',
|
||||
},
|
||||
custom_attributes: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Custom attributes as JSON object',
|
||||
},
|
||||
remote_created_at: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The time the company was created by you as a Unix timestamp',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
@@ -124,6 +131,8 @@ export const intercomCreateCompanyTool: ToolConfig<
|
||||
}
|
||||
}
|
||||
|
||||
if (params.remote_created_at) company.remote_created_at = params.remote_created_at
|
||||
|
||||
return company
|
||||
},
|
||||
},
|
||||
|
||||
@@ -6,6 +6,7 @@ const logger = createLogger('IntercomCreateContact')
|
||||
|
||||
export interface IntercomCreateContactParams {
|
||||
accessToken: string
|
||||
role?: 'user' | 'lead'
|
||||
email?: string
|
||||
external_id?: string
|
||||
phone?: string
|
||||
@@ -16,6 +17,7 @@ export interface IntercomCreateContactParams {
|
||||
owner_id?: string
|
||||
unsubscribed_from_emails?: boolean
|
||||
custom_attributes?: string
|
||||
company_id?: string
|
||||
}
|
||||
|
||||
export interface IntercomCreateContactResponse {
|
||||
@@ -46,66 +48,79 @@ export const intercomCreateContactTool: ToolConfig<
|
||||
visibility: 'hidden',
|
||||
description: 'Intercom API access token',
|
||||
},
|
||||
role: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
"The role of the contact. Accepts 'user' or 'lead'. Defaults to 'lead' if not specified.",
|
||||
},
|
||||
email: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: "The contact's email address",
|
||||
},
|
||||
external_id: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'A unique identifier for the contact provided by the client',
|
||||
},
|
||||
phone: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: "The contact's phone number",
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: "The contact's name",
|
||||
},
|
||||
avatar: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'An avatar image URL for the contact',
|
||||
},
|
||||
signed_up_at: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The time the user signed up as a Unix timestamp',
|
||||
},
|
||||
last_seen_at: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The time the user was last seen as a Unix timestamp',
|
||||
},
|
||||
owner_id: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The id of an admin that has been assigned account ownership of the contact',
|
||||
},
|
||||
unsubscribed_from_emails: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether the contact is unsubscribed from emails',
|
||||
},
|
||||
custom_attributes: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Custom attributes as JSON object (e.g., {"attribute_name": "value"})',
|
||||
},
|
||||
company_id: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Company ID to associate the contact with during creation',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
@@ -119,6 +134,7 @@ export const intercomCreateContactTool: ToolConfig<
|
||||
body: (params) => {
|
||||
const contact: any = {}
|
||||
|
||||
if (params.role) contact.role = params.role
|
||||
if (params.email) contact.email = params.email
|
||||
if (params.external_id) contact.external_id = params.external_id
|
||||
if (params.phone) contact.phone = params.phone
|
||||
@@ -138,6 +154,8 @@ export const intercomCreateContactTool: ToolConfig<
|
||||
}
|
||||
}
|
||||
|
||||
if (params.company_id) contact.company_id = params.company_id
|
||||
|
||||
return contact
|
||||
},
|
||||
},
|
||||
|
||||
@@ -6,13 +6,15 @@ const logger = createLogger('IntercomCreateMessage')
|
||||
|
||||
export interface IntercomCreateMessageParams {
|
||||
accessToken: string
|
||||
message_type: string
|
||||
message_type: 'inapp' | 'email'
|
||||
template: 'plain' | 'personal'
|
||||
subject?: string
|
||||
body: string
|
||||
from_type: string
|
||||
from_id: string
|
||||
to_type: string
|
||||
to_id: string
|
||||
created_at?: number
|
||||
}
|
||||
|
||||
export interface IntercomCreateMessageResponse {
|
||||
@@ -46,45 +48,59 @@ export const intercomCreateMessageTool: ToolConfig<
|
||||
message_type: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Message type: "inapp" or "email"',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Message type: "inapp" for in-app messages or "email" for email messages',
|
||||
},
|
||||
template: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Message template style: "plain" for plain text or "personal" for personalized style',
|
||||
},
|
||||
subject: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The subject of the message (for email type)',
|
||||
},
|
||||
body: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The body of the message',
|
||||
},
|
||||
from_type: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Sender type: "admin"',
|
||||
},
|
||||
from_id: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the admin sending the message',
|
||||
},
|
||||
to_type: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Recipient type: "contact"',
|
||||
},
|
||||
to_id: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the contact receiving the message',
|
||||
},
|
||||
created_at: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Unix timestamp for when the message was created. If not provided, current time is used.',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
@@ -96,8 +112,12 @@ export const intercomCreateMessageTool: ToolConfig<
|
||||
'Intercom-Version': '2.14',
|
||||
}),
|
||||
body: (params) => {
|
||||
// Map "inapp" to "in_app" as required by Intercom API
|
||||
const apiMessageType = params.message_type === 'inapp' ? 'in_app' : params.message_type
|
||||
|
||||
const message: any = {
|
||||
message_type: params.message_type,
|
||||
message_type: apiMessageType,
|
||||
template: params.template,
|
||||
body: params.body,
|
||||
from: {
|
||||
type: params.from_type,
|
||||
@@ -113,6 +133,8 @@ export const intercomCreateMessageTool: ToolConfig<
|
||||
message.subject = params.subject
|
||||
}
|
||||
|
||||
if (params.created_at) message.created_at = params.created_at
|
||||
|
||||
return message
|
||||
},
|
||||
},
|
||||
|
||||
@@ -9,6 +9,10 @@ export interface IntercomCreateTicketParams {
|
||||
ticket_type_id: string
|
||||
contacts: string
|
||||
ticket_attributes: string
|
||||
company_id?: string
|
||||
created_at?: number
|
||||
conversation_to_link_id?: string
|
||||
disable_notifications?: boolean
|
||||
}
|
||||
|
||||
export interface IntercomCreateTicketResponse {
|
||||
@@ -42,22 +46,47 @@ export const intercomCreateTicketTool: ToolConfig<
|
||||
ticket_type_id: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the ticket type',
|
||||
},
|
||||
contacts: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'JSON array of contact identifiers (e.g., [{"id": "contact_id"}])',
|
||||
},
|
||||
ticket_attributes: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'JSON object with ticket attributes including _default_title_ and _default_description_',
|
||||
},
|
||||
company_id: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Company ID to associate the ticket with',
|
||||
},
|
||||
created_at: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Unix timestamp for when the ticket was created. If not provided, current time is used.',
|
||||
},
|
||||
conversation_to_link_id: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'ID of an existing conversation to link to this ticket',
|
||||
},
|
||||
disable_notifications: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'When true, suppresses notifications when the ticket is created',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
@@ -87,6 +116,13 @@ export const intercomCreateTicketTool: ToolConfig<
|
||||
throw new Error('ticket_attributes must be a valid JSON object')
|
||||
}
|
||||
|
||||
if (params.company_id) ticket.company_id = params.company_id
|
||||
if (params.created_at) ticket.created_at = params.created_at
|
||||
if (params.conversation_to_link_id)
|
||||
ticket.conversation_to_link_id = params.conversation_to_link_id
|
||||
if (params.disable_notifications !== undefined)
|
||||
ticket.disable_notifications = params.disable_notifications
|
||||
|
||||
return ticket
|
||||
},
|
||||
},
|
||||
|
||||
@@ -40,7 +40,7 @@ export const intercomDeleteContactTool: ToolConfig<
|
||||
contactId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Contact ID to delete',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -39,7 +39,7 @@ export const intercomGetCompanyTool: ToolConfig<
|
||||
companyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Company ID to retrieve',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -39,7 +39,7 @@ export const intercomGetContactTool: ToolConfig<
|
||||
contactId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Contact ID to retrieve',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -8,6 +8,7 @@ export interface IntercomGetConversationParams {
|
||||
accessToken: string
|
||||
conversationId: string
|
||||
display_as?: string
|
||||
include_translations?: boolean
|
||||
}
|
||||
|
||||
export interface IntercomGetConversationResponse {
|
||||
@@ -40,24 +41,35 @@ export const intercomGetConversationTool: ToolConfig<
|
||||
conversationId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Conversation ID to retrieve',
|
||||
},
|
||||
display_as: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Set to "plaintext" to retrieve messages in plain text',
|
||||
},
|
||||
include_translations: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'When true, conversation parts will be translated to the detected language of the conversation',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) => {
|
||||
const url = buildIntercomUrl(`/conversations/${params.conversationId}`)
|
||||
if (params.display_as) {
|
||||
return `${url}?display_as=${params.display_as}`
|
||||
}
|
||||
return url
|
||||
const queryParams = new URLSearchParams()
|
||||
|
||||
if (params.display_as) queryParams.append('display_as', params.display_as)
|
||||
if (params.include_translations !== undefined)
|
||||
queryParams.append('include_translations', String(params.include_translations))
|
||||
|
||||
const queryString = queryParams.toString()
|
||||
return queryString ? `${url}?${queryString}` : url
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => ({
|
||||
|
||||
@@ -37,7 +37,7 @@ export const intercomGetTicketTool: ToolConfig<IntercomGetTicketParams, Intercom
|
||||
ticketId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Ticket ID to retrieve',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -8,6 +8,7 @@ export interface IntercomListCompaniesParams {
|
||||
accessToken: string
|
||||
per_page?: number
|
||||
page?: number
|
||||
starting_after?: string
|
||||
}
|
||||
|
||||
export interface IntercomListCompaniesResponse {
|
||||
@@ -43,15 +44,21 @@ export const intercomListCompaniesTool: ToolConfig<
|
||||
per_page: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Number of results per page',
|
||||
},
|
||||
page: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Page number',
|
||||
},
|
||||
starting_after: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Cursor for pagination (preferred over page-based pagination)',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
@@ -61,6 +68,7 @@ export const intercomListCompaniesTool: ToolConfig<
|
||||
|
||||
if (params.per_page) queryParams.append('per_page', params.per_page.toString())
|
||||
if (params.page) queryParams.append('page', params.page.toString())
|
||||
if (params.starting_after) queryParams.append('starting_after', params.starting_after)
|
||||
|
||||
const queryString = queryParams.toString()
|
||||
return queryString ? `${url}?${queryString}` : url
|
||||
|
||||
@@ -42,13 +42,13 @@ export const intercomListContactsTool: ToolConfig<
|
||||
per_page: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Number of results per page (max: 150)',
|
||||
},
|
||||
starting_after: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Cursor for pagination - ID to start after',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -8,6 +8,8 @@ export interface IntercomListConversationsParams {
|
||||
accessToken: string
|
||||
per_page?: number
|
||||
starting_after?: string
|
||||
sort?: string
|
||||
order?: 'asc' | 'desc'
|
||||
}
|
||||
|
||||
export interface IntercomListConversationsResponse {
|
||||
@@ -42,15 +44,27 @@ export const intercomListConversationsTool: ToolConfig<
|
||||
per_page: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Number of results per page (max: 150)',
|
||||
},
|
||||
starting_after: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Cursor for pagination',
|
||||
},
|
||||
sort: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Field to sort by (e.g., "waiting_since", "updated_at", "created_at")',
|
||||
},
|
||||
order: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Sort order: "asc" (ascending) or "desc" (descending)',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
@@ -60,6 +74,8 @@ export const intercomListConversationsTool: ToolConfig<
|
||||
|
||||
if (params.per_page) queryParams.append('per_page', params.per_page.toString())
|
||||
if (params.starting_after) queryParams.append('starting_after', params.starting_after)
|
||||
if (params.sort) queryParams.append('sort', params.sort)
|
||||
if (params.order) queryParams.append('order', params.order)
|
||||
|
||||
const queryString = queryParams.toString()
|
||||
return queryString ? `${url}?${queryString}` : url
|
||||
|
||||
@@ -11,6 +11,7 @@ export interface IntercomReplyConversationParams {
|
||||
body: string
|
||||
admin_id?: string
|
||||
attachment_urls?: string
|
||||
created_at?: number
|
||||
}
|
||||
|
||||
export interface IntercomReplyConversationResponse {
|
||||
@@ -44,34 +45,41 @@ export const intercomReplyConversationTool: ToolConfig<
|
||||
conversationId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Conversation ID to reply to',
|
||||
},
|
||||
message_type: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Message type: "comment" or "note"',
|
||||
},
|
||||
body: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The text body of the reply',
|
||||
},
|
||||
admin_id: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'The ID of the admin authoring the reply. If not provided, a default admin (Operator/Fin) will be used.',
|
||||
},
|
||||
attachment_urls: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Comma-separated list of image URLs (max 10)',
|
||||
},
|
||||
created_at: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Unix timestamp for when the reply was created. If not provided, current time is used.',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
@@ -98,6 +106,8 @@ export const intercomReplyConversationTool: ToolConfig<
|
||||
.slice(0, 10)
|
||||
}
|
||||
|
||||
if (params.created_at) reply.created_at = params.created_at
|
||||
|
||||
return reply
|
||||
},
|
||||
},
|
||||
|
||||
@@ -9,6 +9,8 @@ export interface IntercomSearchContactsParams {
|
||||
query: string
|
||||
per_page?: number
|
||||
starting_after?: string
|
||||
sort_field?: string
|
||||
sort_order?: 'ascending' | 'descending'
|
||||
}
|
||||
|
||||
export interface IntercomSearchContactsResponse {
|
||||
@@ -43,22 +45,34 @@ export const intercomSearchContactsTool: ToolConfig<
|
||||
query: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'Search query (e.g., {"field":"email","operator":"=","value":"user@example.com"})',
|
||||
},
|
||||
per_page: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Number of results per page (max: 150)',
|
||||
},
|
||||
starting_after: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Cursor for pagination',
|
||||
},
|
||||
sort_field: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Field to sort by (e.g., "name", "created_at", "last_seen_at")',
|
||||
},
|
||||
sort_order: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Sort order: "ascending" or "descending"',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
@@ -89,6 +103,13 @@ export const intercomSearchContactsTool: ToolConfig<
|
||||
if (params.starting_after)
|
||||
body.pagination = { ...body.pagination, starting_after: params.starting_after }
|
||||
|
||||
if (params.sort_field) {
|
||||
body.sort = {
|
||||
field: params.sort_field,
|
||||
order: params.sort_order || 'descending',
|
||||
}
|
||||
}
|
||||
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
@@ -9,6 +9,8 @@ export interface IntercomSearchConversationsParams {
|
||||
query: string
|
||||
per_page?: number
|
||||
starting_after?: string
|
||||
sort_field?: string
|
||||
sort_order?: 'ascending' | 'descending'
|
||||
}
|
||||
|
||||
export interface IntercomSearchConversationsResponse {
|
||||
@@ -43,21 +45,33 @@ export const intercomSearchConversationsTool: ToolConfig<
|
||||
query: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Search query as JSON object',
|
||||
},
|
||||
per_page: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Number of results per page (max: 150)',
|
||||
},
|
||||
starting_after: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Cursor for pagination',
|
||||
},
|
||||
sort_field: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Field to sort by (e.g., "created_at", "updated_at")',
|
||||
},
|
||||
sort_order: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Sort order: "ascending" or "descending"',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
@@ -88,6 +102,13 @@ export const intercomSearchConversationsTool: ToolConfig<
|
||||
if (params.starting_after)
|
||||
body.pagination = { ...body.pagination, starting_after: params.starting_after }
|
||||
|
||||
if (params.sort_field) {
|
||||
body.sort = {
|
||||
field: params.sort_field,
|
||||
order: params.sort_order || 'descending',
|
||||
}
|
||||
}
|
||||
|
||||
return body
|
||||
},
|
||||
},
|
||||
|
||||
@@ -7,6 +7,8 @@ const logger = createLogger('IntercomUpdateContact')
|
||||
export interface IntercomUpdateContactParams {
|
||||
accessToken: string
|
||||
contactId: string
|
||||
role?: 'user' | 'lead'
|
||||
external_id?: string
|
||||
email?: string
|
||||
phone?: string
|
||||
name?: string
|
||||
@@ -16,6 +18,7 @@ export interface IntercomUpdateContactParams {
|
||||
owner_id?: string
|
||||
unsubscribed_from_emails?: boolean
|
||||
custom_attributes?: string
|
||||
company_id?: string
|
||||
}
|
||||
|
||||
export interface IntercomUpdateContactResponse {
|
||||
@@ -49,63 +52,81 @@ export const intercomUpdateContactTool: ToolConfig<
|
||||
contactId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Contact ID to update',
|
||||
},
|
||||
role: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: "The role of the contact. Accepts 'user' or 'lead'.",
|
||||
},
|
||||
external_id: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'A unique identifier for the contact provided by the client',
|
||||
},
|
||||
email: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: "The contact's email address",
|
||||
},
|
||||
phone: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: "The contact's phone number",
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: "The contact's name",
|
||||
},
|
||||
avatar: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'An avatar image URL for the contact',
|
||||
},
|
||||
signed_up_at: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The time the user signed up as a Unix timestamp',
|
||||
},
|
||||
last_seen_at: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The time the user was last seen as a Unix timestamp',
|
||||
},
|
||||
owner_id: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The id of an admin that has been assigned account ownership of the contact',
|
||||
},
|
||||
unsubscribed_from_emails: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether the contact is unsubscribed from emails',
|
||||
},
|
||||
custom_attributes: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Custom attributes as JSON object (e.g., {"attribute_name": "value"})',
|
||||
},
|
||||
company_id: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Company ID to associate the contact with',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
@@ -119,6 +140,8 @@ export const intercomUpdateContactTool: ToolConfig<
|
||||
body: (params) => {
|
||||
const contact: any = {}
|
||||
|
||||
if (params.role) contact.role = params.role
|
||||
if (params.external_id) contact.external_id = params.external_id
|
||||
if (params.email) contact.email = params.email
|
||||
if (params.phone) contact.phone = params.phone
|
||||
if (params.name) contact.name = params.name
|
||||
@@ -137,6 +160,8 @@ export const intercomUpdateContactTool: ToolConfig<
|
||||
}
|
||||
}
|
||||
|
||||
if (params.company_id) contact.company_id = params.company_id
|
||||
|
||||
return contact
|
||||
},
|
||||
},
|
||||
|
||||
@@ -473,7 +473,6 @@ function extractToolInfo(
|
||||
if (outputsFieldMatch) {
|
||||
const outputsContent = outputsFieldMatch[1]
|
||||
outputs = parseToolOutputsField(outputsContent)
|
||||
console.log(`Found tool outputs field for ${toolName}:`, Object.keys(outputs))
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -838,7 +837,6 @@ function extractManualContent(existingContent: string): Record<string, string> {
|
||||
const sectionName = match[1]
|
||||
const content = match[2].trim()
|
||||
manualSections[sectionName] = content
|
||||
console.log(`Found manual content for section: ${sectionName}`)
|
||||
}
|
||||
|
||||
return manualSections
|
||||
@@ -853,13 +851,6 @@ function mergeWithManualContent(
|
||||
return generatedMarkdown
|
||||
}
|
||||
|
||||
console.log('Merging manual content with generated markdown')
|
||||
|
||||
console.log(`Found ${Object.keys(manualSections).length} manual sections`)
|
||||
Object.keys(manualSections).forEach((section) => {
|
||||
console.log(` - ${section}: ${manualSections[section].substring(0, 20)}...`)
|
||||
})
|
||||
|
||||
let mergedContent = generatedMarkdown
|
||||
|
||||
Object.entries(manualSections).forEach(([sectionName, content]) => {
|
||||
@@ -885,7 +876,6 @@ function mergeWithManualContent(
|
||||
|
||||
if (match && match.index !== undefined) {
|
||||
const insertPosition = match.index + match[0].length
|
||||
console.log(`Inserting ${sectionName} content after position ${insertPosition}`)
|
||||
mergedContent = `${mergedContent.slice(0, insertPosition)}\n\n{/* MANUAL-CONTENT-START:${sectionName} */}\n${content}\n{/* MANUAL-CONTENT-END */}\n${mergedContent.slice(insertPosition)}`
|
||||
} else {
|
||||
console.log(
|
||||
@@ -945,7 +935,6 @@ async function generateBlockDoc(blockPath: string) {
|
||||
let existingContent: string | null = null
|
||||
if (fs.existsSync(outputFilePath)) {
|
||||
existingContent = fs.readFileSync(outputFilePath, 'utf-8')
|
||||
console.log(`Existing file found for ${blockConfig.type}.mdx, checking for manual content...`)
|
||||
}
|
||||
|
||||
const manualSections = existingContent ? extractManualContent(existingContent) : {}
|
||||
@@ -954,14 +943,10 @@ async function generateBlockDoc(blockPath: string) {
|
||||
|
||||
let finalContent = markdown
|
||||
if (Object.keys(manualSections).length > 0) {
|
||||
console.log(`Found manual content in ${blockConfig.type}.mdx, merging...`)
|
||||
finalContent = mergeWithManualContent(markdown, existingContent, manualSections)
|
||||
} else {
|
||||
console.log(`No manual content found in ${blockConfig.type}.mdx`)
|
||||
}
|
||||
|
||||
fs.writeFileSync(outputFilePath, finalContent)
|
||||
console.log(`Generated documentation for ${blockConfig.type}`)
|
||||
} catch (error) {
|
||||
console.error(`Error processing ${blockPath}:`, error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user