chore: import upstream snapshot with attribution
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import { IntercomIcon } from '@/components/icons'
|
||||
import { buildTriggerSubBlocks } from '@/triggers'
|
||||
import {
|
||||
buildIntercomContactOutputs,
|
||||
buildIntercomExtraFields,
|
||||
intercomSetupInstructions,
|
||||
intercomTriggerOptions,
|
||||
} from '@/triggers/intercom/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
/**
|
||||
* Intercom Contact Created Trigger
|
||||
*
|
||||
* Fires when a new lead is created in Intercom.
|
||||
* Note: In Intercom, contact.created fires for leads only.
|
||||
* For identified users, use the User Created trigger (user.created topic).
|
||||
*/
|
||||
export const intercomContactCreatedTrigger: TriggerConfig = {
|
||||
id: 'intercom_contact_created',
|
||||
name: 'Intercom Contact Created',
|
||||
provider: 'intercom',
|
||||
description: 'Trigger workflow when a new lead is created in Intercom',
|
||||
version: '1.0.0',
|
||||
icon: IntercomIcon,
|
||||
|
||||
subBlocks: buildTriggerSubBlocks({
|
||||
triggerId: 'intercom_contact_created',
|
||||
triggerOptions: intercomTriggerOptions,
|
||||
setupInstructions: intercomSetupInstructions('contact.created'),
|
||||
extraFields: buildIntercomExtraFields('intercom_contact_created'),
|
||||
}),
|
||||
|
||||
outputs: buildIntercomContactOutputs(),
|
||||
|
||||
webhook: {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import { IntercomIcon } from '@/components/icons'
|
||||
import { buildTriggerSubBlocks } from '@/triggers'
|
||||
import {
|
||||
buildIntercomConversationOutputs,
|
||||
buildIntercomExtraFields,
|
||||
intercomSetupInstructions,
|
||||
intercomTriggerOptions,
|
||||
} from '@/triggers/intercom/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
/**
|
||||
* Intercom Conversation Closed Trigger
|
||||
*
|
||||
* Fires when an admin closes a conversation.
|
||||
*/
|
||||
export const intercomConversationClosedTrigger: TriggerConfig = {
|
||||
id: 'intercom_conversation_closed',
|
||||
name: 'Intercom Conversation Closed',
|
||||
provider: 'intercom',
|
||||
description: 'Trigger workflow when a conversation is closed in Intercom',
|
||||
version: '1.0.0',
|
||||
icon: IntercomIcon,
|
||||
|
||||
subBlocks: buildTriggerSubBlocks({
|
||||
triggerId: 'intercom_conversation_closed',
|
||||
triggerOptions: intercomTriggerOptions,
|
||||
setupInstructions: intercomSetupInstructions('conversation.admin.closed'),
|
||||
extraFields: buildIntercomExtraFields('intercom_conversation_closed'),
|
||||
}),
|
||||
|
||||
outputs: buildIntercomConversationOutputs(),
|
||||
|
||||
webhook: {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { IntercomIcon } from '@/components/icons'
|
||||
import { buildTriggerSubBlocks } from '@/triggers'
|
||||
import {
|
||||
buildIntercomConversationOutputs,
|
||||
buildIntercomExtraFields,
|
||||
intercomSetupInstructions,
|
||||
intercomTriggerOptions,
|
||||
} from '@/triggers/intercom/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
/**
|
||||
* Intercom Conversation Created Trigger
|
||||
*
|
||||
* This is the PRIMARY trigger - it includes the dropdown for selecting trigger type.
|
||||
* Fires when a user/lead starts a new conversation or an admin initiates a 1:1 conversation.
|
||||
*/
|
||||
export const intercomConversationCreatedTrigger: TriggerConfig = {
|
||||
id: 'intercom_conversation_created',
|
||||
name: 'Intercom Conversation Created',
|
||||
provider: 'intercom',
|
||||
description: 'Trigger workflow when a new conversation is created in Intercom',
|
||||
version: '1.0.0',
|
||||
icon: IntercomIcon,
|
||||
|
||||
subBlocks: buildTriggerSubBlocks({
|
||||
triggerId: 'intercom_conversation_created',
|
||||
triggerOptions: intercomTriggerOptions,
|
||||
includeDropdown: true,
|
||||
setupInstructions: intercomSetupInstructions(
|
||||
'conversation.user.created and/or conversation.admin.single.created'
|
||||
),
|
||||
extraFields: buildIntercomExtraFields('intercom_conversation_created'),
|
||||
}),
|
||||
|
||||
outputs: buildIntercomConversationOutputs(),
|
||||
|
||||
webhook: {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { IntercomIcon } from '@/components/icons'
|
||||
import { buildTriggerSubBlocks } from '@/triggers'
|
||||
import {
|
||||
buildIntercomConversationOutputs,
|
||||
buildIntercomExtraFields,
|
||||
intercomSetupInstructions,
|
||||
intercomTriggerOptions,
|
||||
} from '@/triggers/intercom/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
/**
|
||||
* Intercom Conversation Reply Trigger
|
||||
*
|
||||
* Fires when a user, lead, or admin replies to a conversation.
|
||||
*/
|
||||
export const intercomConversationReplyTrigger: TriggerConfig = {
|
||||
id: 'intercom_conversation_reply',
|
||||
name: 'Intercom Conversation Reply',
|
||||
provider: 'intercom',
|
||||
description: 'Trigger workflow when someone replies to an Intercom conversation',
|
||||
version: '1.0.0',
|
||||
icon: IntercomIcon,
|
||||
|
||||
subBlocks: buildTriggerSubBlocks({
|
||||
triggerId: 'intercom_conversation_reply',
|
||||
triggerOptions: intercomTriggerOptions,
|
||||
setupInstructions: intercomSetupInstructions(
|
||||
'conversation.user.replied and/or conversation.admin.replied'
|
||||
),
|
||||
extraFields: buildIntercomExtraFields('intercom_conversation_reply'),
|
||||
}),
|
||||
|
||||
outputs: buildIntercomConversationOutputs(),
|
||||
|
||||
webhook: {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export { intercomContactCreatedTrigger } from './contact_created'
|
||||
export { intercomConversationClosedTrigger } from './conversation_closed'
|
||||
export { intercomConversationCreatedTrigger } from './conversation_created'
|
||||
export { intercomConversationReplyTrigger } from './conversation_reply'
|
||||
export { intercomUserCreatedTrigger } from './user_created'
|
||||
export { intercomWebhookTrigger } from './webhook'
|
||||
@@ -0,0 +1,41 @@
|
||||
import { IntercomIcon } from '@/components/icons'
|
||||
import { buildTriggerSubBlocks } from '@/triggers'
|
||||
import {
|
||||
buildIntercomContactOutputs,
|
||||
buildIntercomExtraFields,
|
||||
intercomSetupInstructions,
|
||||
intercomTriggerOptions,
|
||||
} from '@/triggers/intercom/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
/**
|
||||
* Intercom User Created Trigger
|
||||
*
|
||||
* Fires when a new identified user is created in Intercom.
|
||||
* Note: In Intercom, user.created fires for identified users only.
|
||||
* For anonymous leads, use the Contact Created trigger (contact.created topic).
|
||||
*/
|
||||
export const intercomUserCreatedTrigger: TriggerConfig = {
|
||||
id: 'intercom_user_created',
|
||||
name: 'Intercom User Created',
|
||||
provider: 'intercom',
|
||||
description: 'Trigger workflow when a new user is created in Intercom',
|
||||
version: '1.0.0',
|
||||
icon: IntercomIcon,
|
||||
|
||||
subBlocks: buildTriggerSubBlocks({
|
||||
triggerId: 'intercom_user_created',
|
||||
triggerOptions: intercomTriggerOptions,
|
||||
setupInstructions: intercomSetupInstructions('user.created'),
|
||||
extraFields: buildIntercomExtraFields('intercom_user_created'),
|
||||
}),
|
||||
|
||||
outputs: buildIntercomContactOutputs(),
|
||||
|
||||
webhook: {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
import type { SubBlockConfig } from '@/blocks/types'
|
||||
import type { TriggerOutput } from '@/triggers/types'
|
||||
|
||||
/**
|
||||
* Dropdown options for the Intercom trigger type selector.
|
||||
*/
|
||||
export const intercomTriggerOptions = [
|
||||
{ label: 'Conversation Created', id: 'intercom_conversation_created' },
|
||||
{ label: 'Conversation Reply', id: 'intercom_conversation_reply' },
|
||||
{ label: 'Conversation Closed', id: 'intercom_conversation_closed' },
|
||||
{ label: 'Contact Created', id: 'intercom_contact_created' },
|
||||
{ label: 'User Created', id: 'intercom_user_created' },
|
||||
{ label: 'All Events', id: 'intercom_webhook' },
|
||||
]
|
||||
|
||||
/**
|
||||
* Generates HTML setup instructions for Intercom webhook triggers.
|
||||
*/
|
||||
export function intercomSetupInstructions(eventType: string): string {
|
||||
const instructions = [
|
||||
'Copy the <strong>Webhook URL</strong> above.',
|
||||
'Go to your <a href="https://app.intercom.com/a/apps/_/developer-hub" target="_blank" rel="noopener noreferrer">Intercom Developer Hub</a>.',
|
||||
'Select your app, then go to <strong>Webhooks</strong>.',
|
||||
'Paste the webhook URL into the <strong>Endpoint URL</strong> field.',
|
||||
`Select the <strong>${eventType}</strong> topic(s).`,
|
||||
"Copy your app's <strong>Client Secret</strong> from the app's <strong>Basic Information</strong> page and paste it into the <strong>Webhook Secret</strong> field above (recommended for security).",
|
||||
'Save the webhook configuration.',
|
||||
'Deploy your workflow to activate the trigger.',
|
||||
]
|
||||
|
||||
return instructions
|
||||
.map(
|
||||
(instruction, index) =>
|
||||
`<div class="mb-3"><strong>${index + 1}.</strong> ${instruction}</div>`
|
||||
)
|
||||
.join('')
|
||||
}
|
||||
|
||||
/**
|
||||
* Extra fields for Intercom triggers (webhook secret for signature verification).
|
||||
*/
|
||||
export function buildIntercomExtraFields(triggerId: string): SubBlockConfig[] {
|
||||
return [
|
||||
{
|
||||
id: 'webhookSecret',
|
||||
title: 'Webhook Secret',
|
||||
type: 'short-input',
|
||||
placeholder: 'Enter your Intercom app Client Secret',
|
||||
description:
|
||||
"Your app's Client Secret from the Developer Hub. Used to verify webhook authenticity via X-Hub-Signature.",
|
||||
password: true,
|
||||
mode: 'trigger',
|
||||
condition: { field: 'selectedTriggerId', value: triggerId },
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps trigger IDs to the Intercom webhook topics they should match.
|
||||
*/
|
||||
export const INTERCOM_TRIGGER_TOPIC_MAP: Record<string, string[]> = {
|
||||
intercom_conversation_created: ['conversation.user.created', 'conversation.admin.single.created'],
|
||||
intercom_conversation_reply: ['conversation.user.replied', 'conversation.admin.replied'],
|
||||
intercom_conversation_closed: ['conversation.admin.closed'],
|
||||
intercom_contact_created: ['contact.created'],
|
||||
intercom_user_created: ['user.created'],
|
||||
intercom_webhook: [], // Empty = accept all events
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an Intercom webhook event matches the configured trigger.
|
||||
*/
|
||||
export function isIntercomEventMatch(triggerId: string, topic: string): boolean {
|
||||
const allowedTopics = INTERCOM_TRIGGER_TOPIC_MAP[triggerId]
|
||||
if (allowedTopics === undefined) return false
|
||||
if (allowedTopics.length === 0) {
|
||||
return true
|
||||
}
|
||||
return allowedTopics.includes(topic)
|
||||
}
|
||||
|
||||
/**
|
||||
* Shared base outputs for all Intercom webhook triggers.
|
||||
*/
|
||||
function buildIntercomBaseOutputs(dataDescription: string): Record<string, TriggerOutput> {
|
||||
return {
|
||||
topic: { type: 'string', description: 'The webhook topic (e.g., conversation.user.created)' },
|
||||
id: { type: 'string', description: 'Unique notification ID' },
|
||||
app_id: { type: 'string', description: 'Your Intercom app ID' },
|
||||
created_at: { type: 'number', description: 'Unix timestamp when the event occurred' },
|
||||
delivery_attempts: {
|
||||
type: 'number',
|
||||
description: 'Number of delivery attempts for this notification',
|
||||
},
|
||||
first_sent_at: {
|
||||
type: 'number',
|
||||
description: 'Unix timestamp of first delivery attempt',
|
||||
},
|
||||
data: { type: 'json', description: dataDescription },
|
||||
} as Record<string, TriggerOutput>
|
||||
}
|
||||
|
||||
/**
|
||||
* Build outputs for Intercom conversation triggers.
|
||||
*/
|
||||
export function buildIntercomConversationOutputs(): Record<string, TriggerOutput> {
|
||||
return buildIntercomBaseOutputs(
|
||||
'Event data containing the conversation object. Access via data.item for conversation details including id, state, open, assignee, contacts, conversation_parts, tags, and source'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Build outputs for Intercom contact triggers.
|
||||
*/
|
||||
export function buildIntercomContactOutputs(): Record<string, TriggerOutput> {
|
||||
return buildIntercomBaseOutputs(
|
||||
'Event data containing the contact object. Access via data.item for contact details including id, role, email, name, phone, external_id, custom_attributes, location, avatar, tags, companies, and timestamps'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Build outputs for the generic Intercom webhook trigger.
|
||||
*/
|
||||
export function buildIntercomGenericOutputs(): Record<string, TriggerOutput> {
|
||||
return buildIntercomBaseOutputs(
|
||||
'Event data containing the affected object. Access via data.item for the resource (conversation, contact, company, ticket, etc.)'
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { IntercomIcon } from '@/components/icons'
|
||||
import { buildTriggerSubBlocks } from '@/triggers'
|
||||
import {
|
||||
buildIntercomExtraFields,
|
||||
buildIntercomGenericOutputs,
|
||||
intercomSetupInstructions,
|
||||
intercomTriggerOptions,
|
||||
} from '@/triggers/intercom/utils'
|
||||
import type { TriggerConfig } from '@/triggers/types'
|
||||
|
||||
/**
|
||||
* Intercom Generic Webhook Trigger
|
||||
*
|
||||
* Accepts all Intercom webhook events.
|
||||
*/
|
||||
export const intercomWebhookTrigger: TriggerConfig = {
|
||||
id: 'intercom_webhook',
|
||||
name: 'Intercom Webhook (All Events)',
|
||||
provider: 'intercom',
|
||||
description: 'Trigger workflow on any Intercom webhook event',
|
||||
version: '1.0.0',
|
||||
icon: IntercomIcon,
|
||||
|
||||
subBlocks: buildTriggerSubBlocks({
|
||||
triggerId: 'intercom_webhook',
|
||||
triggerOptions: intercomTriggerOptions,
|
||||
setupInstructions: intercomSetupInstructions(
|
||||
'events you want to receive (conversation, contact, user, company, ticket, etc.)'
|
||||
),
|
||||
extraFields: buildIntercomExtraFields('intercom_webhook'),
|
||||
}),
|
||||
|
||||
outputs: buildIntercomGenericOutputs(),
|
||||
|
||||
webhook: {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user