From 66220630b275c39a70e6d008161987804bba0e0a Mon Sep 17 00:00:00 2001 From: aadamgough Date: Mon, 5 Jan 2026 15:42:33 -0800 Subject: [PATCH 1/3] fixed output and dropdown --- apps/sim/blocks/blocks/grain.ts | 23 +++++++--- apps/sim/triggers/grain/highlight_created.ts | 47 +++++--------------- apps/sim/triggers/grain/highlight_updated.ts | 47 +++++--------------- apps/sim/triggers/grain/recording_created.ts | 47 +++++--------------- apps/sim/triggers/grain/recording_updated.ts | 47 +++++--------------- apps/sim/triggers/grain/story_created.ts | 47 +++++--------------- apps/sim/triggers/grain/utils.ts | 24 +++------- apps/sim/triggers/grain/webhook.ts | 36 --------------- 8 files changed, 72 insertions(+), 246 deletions(-) diff --git a/apps/sim/blocks/blocks/grain.ts b/apps/sim/blocks/blocks/grain.ts index 01e52e083c..97ea198475 100644 --- a/apps/sim/blocks/blocks/grain.ts +++ b/apps/sim/blocks/blocks/grain.ts @@ -2,6 +2,7 @@ import { GrainIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' import { AuthMode } from '@/blocks/types' import { getTrigger } from '@/triggers' +import { grainTriggerOptions } from '@/triggers/grain/utils' export const GrainBlock: BlockConfig = { type: 'grain', @@ -207,13 +208,21 @@ export const GrainBlock: BlockConfig = { value: ['grain_delete_hook'], }, }, - // Trigger SubBlocks - ...getTrigger('grain_recording_created').subBlocks, - ...getTrigger('grain_recording_updated').subBlocks, - ...getTrigger('grain_highlight_created').subBlocks, - ...getTrigger('grain_highlight_updated').subBlocks, - ...getTrigger('grain_story_created').subBlocks, - ...getTrigger('grain_webhook').subBlocks, + { + id: 'selectedTriggerId', + title: 'Trigger Type', + type: 'dropdown', + mode: 'trigger', + options: grainTriggerOptions, + value: () => 'grain_webhook', + required: true, + }, + ...getTrigger('grain_recording_created').subBlocks.slice(1), + ...getTrigger('grain_recording_updated').subBlocks.slice(1), + ...getTrigger('grain_highlight_created').subBlocks.slice(1), + ...getTrigger('grain_highlight_updated').subBlocks.slice(1), + ...getTrigger('grain_story_created').subBlocks.slice(1), + ...getTrigger('grain_webhook').subBlocks.slice(1), ], tools: { access: [ diff --git a/apps/sim/triggers/grain/highlight_created.ts b/apps/sim/triggers/grain/highlight_created.ts index 12ab02d260..4301187950 100644 --- a/apps/sim/triggers/grain/highlight_created.ts +++ b/apps/sim/triggers/grain/highlight_created.ts @@ -1,6 +1,6 @@ import { GrainIcon } from '@/components/icons' import type { TriggerConfig } from '@/triggers/types' -import { buildHighlightOutputs, grainSetupInstructions } from './utils' +import { buildHighlightOutputs, grainSetupInstructions, grainTriggerOptions } from './utils' export const grainHighlightCreatedTrigger: TriggerConfig = { id: 'grain_highlight_created', @@ -11,6 +11,15 @@ export const grainHighlightCreatedTrigger: TriggerConfig = { icon: GrainIcon, subBlocks: [ + { + id: 'selectedTriggerId', + title: 'Trigger Type', + type: 'dropdown', + mode: 'trigger', + options: grainTriggerOptions, + value: () => 'grain_highlight_created', + required: true, + }, { id: 'apiKey', title: 'API Key', @@ -25,42 +34,6 @@ export const grainHighlightCreatedTrigger: TriggerConfig = { value: 'grain_highlight_created', }, }, - { - id: 'includeHighlights', - title: 'Include Highlights', - type: 'switch', - description: 'Include highlights/clips in webhook payload.', - defaultValue: false, - mode: 'trigger', - condition: { - field: 'selectedTriggerId', - value: 'grain_highlight_created', - }, - }, - { - id: 'includeParticipants', - title: 'Include Participants', - type: 'switch', - description: 'Include participant list in webhook payload.', - defaultValue: false, - mode: 'trigger', - condition: { - field: 'selectedTriggerId', - value: 'grain_highlight_created', - }, - }, - { - id: 'includeAiSummary', - title: 'Include AI Summary', - type: 'switch', - description: 'Include AI-generated summary in webhook payload.', - defaultValue: false, - mode: 'trigger', - condition: { - field: 'selectedTriggerId', - value: 'grain_highlight_created', - }, - }, { id: 'triggerInstructions', title: 'Setup Instructions', diff --git a/apps/sim/triggers/grain/highlight_updated.ts b/apps/sim/triggers/grain/highlight_updated.ts index cf8e771589..e4a3b7eb65 100644 --- a/apps/sim/triggers/grain/highlight_updated.ts +++ b/apps/sim/triggers/grain/highlight_updated.ts @@ -1,6 +1,6 @@ import { GrainIcon } from '@/components/icons' import type { TriggerConfig } from '@/triggers/types' -import { buildHighlightOutputs, grainSetupInstructions } from './utils' +import { buildHighlightOutputs, grainSetupInstructions, grainTriggerOptions } from './utils' export const grainHighlightUpdatedTrigger: TriggerConfig = { id: 'grain_highlight_updated', @@ -11,6 +11,15 @@ export const grainHighlightUpdatedTrigger: TriggerConfig = { icon: GrainIcon, subBlocks: [ + { + id: 'selectedTriggerId', + title: 'Trigger Type', + type: 'dropdown', + mode: 'trigger', + options: grainTriggerOptions, + value: () => 'grain_highlight_updated', + required: true, + }, { id: 'apiKey', title: 'API Key', @@ -25,42 +34,6 @@ export const grainHighlightUpdatedTrigger: TriggerConfig = { value: 'grain_highlight_updated', }, }, - { - id: 'includeHighlights', - title: 'Include Highlights', - type: 'switch', - description: 'Include highlights/clips in webhook payload.', - defaultValue: false, - mode: 'trigger', - condition: { - field: 'selectedTriggerId', - value: 'grain_highlight_updated', - }, - }, - { - id: 'includeParticipants', - title: 'Include Participants', - type: 'switch', - description: 'Include participant list in webhook payload.', - defaultValue: false, - mode: 'trigger', - condition: { - field: 'selectedTriggerId', - value: 'grain_highlight_updated', - }, - }, - { - id: 'includeAiSummary', - title: 'Include AI Summary', - type: 'switch', - description: 'Include AI-generated summary in webhook payload.', - defaultValue: false, - mode: 'trigger', - condition: { - field: 'selectedTriggerId', - value: 'grain_highlight_updated', - }, - }, { id: 'triggerInstructions', title: 'Setup Instructions', diff --git a/apps/sim/triggers/grain/recording_created.ts b/apps/sim/triggers/grain/recording_created.ts index 4085f0c751..6877ee6993 100644 --- a/apps/sim/triggers/grain/recording_created.ts +++ b/apps/sim/triggers/grain/recording_created.ts @@ -1,6 +1,6 @@ import { GrainIcon } from '@/components/icons' import type { TriggerConfig } from '@/triggers/types' -import { buildRecordingOutputs, grainSetupInstructions } from './utils' +import { buildRecordingOutputs, grainSetupInstructions, grainTriggerOptions } from './utils' export const grainRecordingCreatedTrigger: TriggerConfig = { id: 'grain_recording_created', @@ -11,6 +11,15 @@ export const grainRecordingCreatedTrigger: TriggerConfig = { icon: GrainIcon, subBlocks: [ + { + id: 'selectedTriggerId', + title: 'Trigger Type', + type: 'dropdown', + mode: 'trigger', + options: grainTriggerOptions, + value: () => 'grain_recording_created', + required: true, + }, { id: 'apiKey', title: 'API Key', @@ -25,42 +34,6 @@ export const grainRecordingCreatedTrigger: TriggerConfig = { value: 'grain_recording_created', }, }, - { - id: 'includeHighlights', - title: 'Include Highlights', - type: 'switch', - description: 'Include highlights/clips in webhook payload.', - defaultValue: false, - mode: 'trigger', - condition: { - field: 'selectedTriggerId', - value: 'grain_recording_created', - }, - }, - { - id: 'includeParticipants', - title: 'Include Participants', - type: 'switch', - description: 'Include participant list in webhook payload.', - defaultValue: false, - mode: 'trigger', - condition: { - field: 'selectedTriggerId', - value: 'grain_recording_created', - }, - }, - { - id: 'includeAiSummary', - title: 'Include AI Summary', - type: 'switch', - description: 'Include AI-generated summary in webhook payload.', - defaultValue: false, - mode: 'trigger', - condition: { - field: 'selectedTriggerId', - value: 'grain_recording_created', - }, - }, { id: 'triggerInstructions', title: 'Setup Instructions', diff --git a/apps/sim/triggers/grain/recording_updated.ts b/apps/sim/triggers/grain/recording_updated.ts index 799424f2e2..1e3130371f 100644 --- a/apps/sim/triggers/grain/recording_updated.ts +++ b/apps/sim/triggers/grain/recording_updated.ts @@ -1,6 +1,6 @@ import { GrainIcon } from '@/components/icons' import type { TriggerConfig } from '@/triggers/types' -import { buildRecordingOutputs, grainSetupInstructions } from './utils' +import { buildRecordingOutputs, grainSetupInstructions, grainTriggerOptions } from './utils' export const grainRecordingUpdatedTrigger: TriggerConfig = { id: 'grain_recording_updated', @@ -11,6 +11,15 @@ export const grainRecordingUpdatedTrigger: TriggerConfig = { icon: GrainIcon, subBlocks: [ + { + id: 'selectedTriggerId', + title: 'Trigger Type', + type: 'dropdown', + mode: 'trigger', + options: grainTriggerOptions, + value: () => 'grain_recording_updated', + required: true, + }, { id: 'apiKey', title: 'API Key', @@ -25,42 +34,6 @@ export const grainRecordingUpdatedTrigger: TriggerConfig = { value: 'grain_recording_updated', }, }, - { - id: 'includeHighlights', - title: 'Include Highlights', - type: 'switch', - description: 'Include highlights/clips in webhook payload.', - defaultValue: false, - mode: 'trigger', - condition: { - field: 'selectedTriggerId', - value: 'grain_recording_updated', - }, - }, - { - id: 'includeParticipants', - title: 'Include Participants', - type: 'switch', - description: 'Include participant list in webhook payload.', - defaultValue: false, - mode: 'trigger', - condition: { - field: 'selectedTriggerId', - value: 'grain_recording_updated', - }, - }, - { - id: 'includeAiSummary', - title: 'Include AI Summary', - type: 'switch', - description: 'Include AI-generated summary in webhook payload.', - defaultValue: false, - mode: 'trigger', - condition: { - field: 'selectedTriggerId', - value: 'grain_recording_updated', - }, - }, { id: 'triggerInstructions', title: 'Setup Instructions', diff --git a/apps/sim/triggers/grain/story_created.ts b/apps/sim/triggers/grain/story_created.ts index e9b7306b83..f3250e5fab 100644 --- a/apps/sim/triggers/grain/story_created.ts +++ b/apps/sim/triggers/grain/story_created.ts @@ -1,6 +1,6 @@ import { GrainIcon } from '@/components/icons' import type { TriggerConfig } from '@/triggers/types' -import { buildStoryOutputs, grainSetupInstructions } from './utils' +import { buildStoryOutputs, grainSetupInstructions, grainTriggerOptions } from './utils' export const grainStoryCreatedTrigger: TriggerConfig = { id: 'grain_story_created', @@ -11,6 +11,15 @@ export const grainStoryCreatedTrigger: TriggerConfig = { icon: GrainIcon, subBlocks: [ + { + id: 'selectedTriggerId', + title: 'Trigger Type', + type: 'dropdown', + mode: 'trigger', + options: grainTriggerOptions, + value: () => 'grain_story_created', + required: true, + }, { id: 'apiKey', title: 'API Key', @@ -25,42 +34,6 @@ export const grainStoryCreatedTrigger: TriggerConfig = { value: 'grain_story_created', }, }, - { - id: 'includeHighlights', - title: 'Include Highlights', - type: 'switch', - description: 'Include highlights/clips in webhook payload.', - defaultValue: false, - mode: 'trigger', - condition: { - field: 'selectedTriggerId', - value: 'grain_story_created', - }, - }, - { - id: 'includeParticipants', - title: 'Include Participants', - type: 'switch', - description: 'Include participant list in webhook payload.', - defaultValue: false, - mode: 'trigger', - condition: { - field: 'selectedTriggerId', - value: 'grain_story_created', - }, - }, - { - id: 'includeAiSummary', - title: 'Include AI Summary', - type: 'switch', - description: 'Include AI-generated summary in webhook payload.', - defaultValue: false, - mode: 'trigger', - condition: { - field: 'selectedTriggerId', - value: 'grain_story_created', - }, - }, { id: 'triggerInstructions', title: 'Setup Instructions', diff --git a/apps/sim/triggers/grain/utils.ts b/apps/sim/triggers/grain/utils.ts index 3c77dd026f..a43c57060d 100644 --- a/apps/sim/triggers/grain/utils.ts +++ b/apps/sim/triggers/grain/utils.ts @@ -19,9 +19,9 @@ export function grainSetupInstructions(eventType: string): string { const instructions = [ 'Enter your Grain API Key (Personal Access Token) above.', 'You can find or create your API key in Grain at Settings > Integrations > API.', - 'Optionally configure filters to narrow which recordings trigger the webhook.', `Click "Save Configuration" to automatically create the webhook in Grain for ${eventType} events.`, 'The webhook will be automatically deleted when you remove this trigger.', + 'To access additional data like AI summaries, highlights, or participants, use the "Grain Get Recording" tool with the recording ID from this trigger.', ] return instructions @@ -40,11 +40,11 @@ export function buildRecordingOutputs(): Record { return { type: { type: 'string', - description: 'Event type (recording_added)', + description: 'Event type (recording_added or recording_updated)', }, user_id: { type: 'string', - description: 'User UUID who triggered the event', + description: 'User UUID who triggered the event (nullable)', }, data: { type: 'object', @@ -76,7 +76,7 @@ export function buildRecordingOutputs(): Record { }, 'data.source': { type: 'string', - description: 'Recording source (zoom, meet, teams, etc.)', + description: 'Recording source (zoom, meet, local_capture, etc.)', }, 'data.url': { type: 'string', @@ -92,23 +92,11 @@ export function buildRecordingOutputs(): Record { }, 'data.teams': { type: 'array', - description: 'Teams the recording belongs to', + description: 'Array of team objects', }, 'data.meeting_type': { type: 'object', - description: 'Meeting type info (nullable)', - }, - 'data.highlights': { - type: 'array', - description: 'Highlights (if configured in hook)', - }, - 'data.participants': { - type: 'array', - description: 'Participants (if configured in hook)', - }, - 'data.ai_summary': { - type: 'object', - description: 'AI summary (if configured in hook)', + description: 'Meeting type info with id, name, scope (nullable)', }, } as Record } diff --git a/apps/sim/triggers/grain/webhook.ts b/apps/sim/triggers/grain/webhook.ts index 88f968682c..d41f21433a 100644 --- a/apps/sim/triggers/grain/webhook.ts +++ b/apps/sim/triggers/grain/webhook.ts @@ -34,42 +34,6 @@ export const grainWebhookTrigger: TriggerConfig = { value: 'grain_webhook', }, }, - { - id: 'includeHighlights', - title: 'Include Highlights', - type: 'switch', - description: 'Include highlights/clips in webhook payload.', - defaultValue: false, - mode: 'trigger', - condition: { - field: 'selectedTriggerId', - value: 'grain_webhook', - }, - }, - { - id: 'includeParticipants', - title: 'Include Participants', - type: 'switch', - description: 'Include participant list in webhook payload.', - defaultValue: false, - mode: 'trigger', - condition: { - field: 'selectedTriggerId', - value: 'grain_webhook', - }, - }, - { - id: 'includeAiSummary', - title: 'Include AI Summary', - type: 'switch', - description: 'Include AI-generated summary in webhook payload.', - defaultValue: false, - mode: 'trigger', - condition: { - field: 'selectedTriggerId', - value: 'grain_webhook', - }, - }, { id: 'triggerInstructions', title: 'Setup Instructions', From 0e3df48506f45d8ac19890201715f34466f43e22 Mon Sep 17 00:00:00 2001 From: aadamgough Date: Mon, 5 Jan 2026 16:29:33 -0800 Subject: [PATCH 2/3] changed payload --- apps/sim/triggers/grain/utils.ts | 222 +++++++++++++++---------------- 1 file changed, 108 insertions(+), 114 deletions(-) diff --git a/apps/sim/triggers/grain/utils.ts b/apps/sim/triggers/grain/utils.ts index a43c57060d..cfe94308ea 100644 --- a/apps/sim/triggers/grain/utils.ts +++ b/apps/sim/triggers/grain/utils.ts @@ -47,56 +47,54 @@ export function buildRecordingOutputs(): Record { description: 'User UUID who triggered the event (nullable)', }, data: { - type: 'object', - description: 'Recording data object', - }, - 'data.id': { - type: 'string', - description: 'Recording UUID', - }, - 'data.title': { - type: 'string', - description: 'Recording title', - }, - 'data.start_datetime': { - type: 'string', - description: 'ISO8601 start timestamp', - }, - 'data.end_datetime': { - type: 'string', - description: 'ISO8601 end timestamp', - }, - 'data.duration_ms': { - type: 'number', - description: 'Duration in milliseconds', - }, - 'data.media_type': { - type: 'string', - description: 'audio, transcript, or video', - }, - 'data.source': { - type: 'string', - description: 'Recording source (zoom, meet, local_capture, etc.)', - }, - 'data.url': { - type: 'string', - description: 'URL to view in Grain', - }, - 'data.thumbnail_url': { - type: 'string', - description: 'Thumbnail URL (nullable)', - }, - 'data.tags': { - type: 'array', - description: 'Array of tag strings', - }, - 'data.teams': { - type: 'array', - description: 'Array of team objects', - }, - 'data.meeting_type': { - type: 'object', - description: 'Meeting type info with id, name, scope (nullable)', + id: { + type: 'string', + description: 'Recording UUID', + }, + title: { + type: 'string', + description: 'Recording title', + }, + start_datetime: { + type: 'string', + description: 'ISO8601 start timestamp', + }, + end_datetime: { + type: 'string', + description: 'ISO8601 end timestamp', + }, + duration_ms: { + type: 'number', + description: 'Duration in milliseconds', + }, + media_type: { + type: 'string', + description: 'audio, transcript, or video', + }, + source: { + type: 'string', + description: 'Recording source (zoom, meet, local_capture, etc.)', + }, + url: { + type: 'string', + description: 'URL to view in Grain', + }, + thumbnail_url: { + type: 'string', + description: 'Thumbnail URL (nullable)', + }, + tags: { + type: 'array', + description: 'Array of tag strings', + }, + teams: { + type: 'array', + description: 'Array of team objects', + }, + meeting_type: { + type: 'object', + description: 'Meeting type info with id, name, scope (nullable)', + }, }, } as Record } @@ -116,52 +114,50 @@ export function buildHighlightOutputs(): Record { description: 'User UUID who triggered the event', }, data: { - type: 'object', - description: 'Highlight data object', - }, - 'data.id': { - type: 'string', - description: 'Highlight UUID', - }, - 'data.recording_id': { - type: 'string', - description: 'Parent recording UUID', - }, - 'data.text': { - type: 'string', - description: 'Highlight title/description', - }, - 'data.transcript': { - type: 'string', - description: 'Transcript text of the clip', - }, - 'data.speakers': { - type: 'array', - description: 'Array of speaker names', - }, - 'data.timestamp': { - type: 'number', - description: 'Start timestamp in ms', - }, - 'data.duration': { - type: 'number', - description: 'Duration in ms', - }, - 'data.tags': { - type: 'array', - description: 'Array of tag strings', - }, - 'data.url': { - type: 'string', - description: 'URL to view in Grain', - }, - 'data.thumbnail_url': { - type: 'string', - description: 'Thumbnail URL', - }, - 'data.created_datetime': { - type: 'string', - description: 'ISO8601 creation timestamp', + id: { + type: 'string', + description: 'Highlight UUID', + }, + recording_id: { + type: 'string', + description: 'Parent recording UUID', + }, + text: { + type: 'string', + description: 'Highlight title/description', + }, + transcript: { + type: 'string', + description: 'Transcript text of the clip', + }, + speakers: { + type: 'array', + description: 'Array of speaker names', + }, + timestamp: { + type: 'number', + description: 'Start timestamp in ms', + }, + duration: { + type: 'number', + description: 'Duration in ms', + }, + tags: { + type: 'array', + description: 'Array of tag strings', + }, + url: { + type: 'string', + description: 'URL to view in Grain', + }, + thumbnail_url: { + type: 'string', + description: 'Thumbnail URL', + }, + created_datetime: { + type: 'string', + description: 'ISO8601 creation timestamp', + }, }, } as Record } @@ -181,24 +177,22 @@ export function buildStoryOutputs(): Record { description: 'User UUID who triggered the event', }, data: { - type: 'object', - description: 'Story data object', - }, - 'data.id': { - type: 'string', - description: 'Story UUID', - }, - 'data.title': { - type: 'string', - description: 'Story title', - }, - 'data.url': { - type: 'string', - description: 'URL to view in Grain', - }, - 'data.created_datetime': { - type: 'string', - description: 'ISO8601 creation timestamp', + id: { + type: 'string', + description: 'Story UUID', + }, + title: { + type: 'string', + description: 'Story title', + }, + url: { + type: 'string', + description: 'URL to view in Grain', + }, + created_datetime: { + type: 'string', + description: 'ISO8601 creation timestamp', + }, }, } as Record } From 28df6665abb8df023c53b186fc905b56b699cf21 Mon Sep 17 00:00:00 2001 From: aadamgough Date: Mon, 5 Jan 2026 16:47:26 -0800 Subject: [PATCH 3/3] removed comments --- apps/sim/triggers/grain/utils.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/sim/triggers/grain/utils.ts b/apps/sim/triggers/grain/utils.ts index cfe94308ea..1d371f9cbb 100644 --- a/apps/sim/triggers/grain/utils.ts +++ b/apps/sim/triggers/grain/utils.ts @@ -21,7 +21,6 @@ export function grainSetupInstructions(eventType: string): string { 'You can find or create your API key in Grain at Settings > Integrations > API.', `Click "Save Configuration" to automatically create the webhook in Grain for ${eventType} events.`, 'The webhook will be automatically deleted when you remove this trigger.', - 'To access additional data like AI summaries, highlights, or participants, use the "Grain Get Recording" tool with the recording ID from this trigger.', ] return instructions @@ -40,11 +39,11 @@ export function buildRecordingOutputs(): Record { return { type: { type: 'string', - description: 'Event type (recording_added or recording_updated)', + description: 'Event type', }, user_id: { type: 'string', - description: 'User UUID who triggered the event (nullable)', + description: 'User UUID who triggered the event', }, data: { id: {