diff --git a/apps/sim/lib/webhooks/utils.ts b/apps/sim/lib/webhooks/utils.ts index 34795018b7..6a57571b99 100644 --- a/apps/sim/lib/webhooks/utils.ts +++ b/apps/sim/lib/webhooks/utils.ts @@ -751,58 +751,54 @@ export async function formatWebhookInput( } // Microsoft Teams outgoing webhook - Teams sending data to us - // const messageText = body?.text || '' const messageId = body?.id || '' const timestamp = body?.timestamp || body?.localTimestamp || '' const from = body?.from || {} const conversation = body?.conversation || {} + // Construct the message object + const messageObj = { + raw: { + attachments: body?.attachments || [], + channelData: body?.channelData || {}, + conversation: body?.conversation || {}, + text: messageText, + messageType: body?.type || 'message', + channelId: body?.channelId || '', + timestamp, + }, + } + + // Construct the from object + const fromObj = { + id: from.id || '', + name: from.name || '', + aadObjectId: from.aadObjectId || '', + } + + // Construct the conversation object + const conversationObj = { + id: conversation.id || '', + name: conversation.name || '', + isGroup: conversation.isGroup || false, + tenantId: conversation.tenantId || '', + aadObjectId: conversation.aadObjectId || '', + conversationType: conversation.conversationType || '', + } + + // Construct the activity object + const activityObj = body || {} + return { input: messageText, // Primary workflow input - the message text - // Top-level properties for backward compatibility with syntax - type: body?.type || 'message', - id: messageId, - timestamp, - localTimestamp: body?.localTimestamp || '', - serviceUrl: body?.serviceUrl || '', - channelId: body?.channelId || '', - from_id: from.id || '', - from_name: from.name || '', - conversation_id: conversation.id || '', - text: messageText, + // Top-level properties for direct access with syntax + from: fromObj, + message: messageObj, + activity: activityObj, + conversation: conversationObj, - microsoftteams: { - message: { - id: messageId, - text: messageText, - timestamp, - type: body?.type || 'message', - serviceUrl: body?.serviceUrl, - channelId: body?.channelId, - raw: body, - }, - from: { - id: from.id, - name: from.name, - aadObjectId: from.aadObjectId, - }, - conversation: { - id: conversation.id, - name: conversation.name, - conversationType: conversation.conversationType, - tenantId: conversation.tenantId, - }, - activity: { - type: body?.type, - id: body?.id, - timestamp: body?.timestamp, - localTimestamp: body?.localTimestamp, - serviceUrl: body?.serviceUrl, - channelId: body?.channelId, - }, - }, webhook: { data: { provider: 'microsoftteams', diff --git a/apps/sim/triggers/gmail/poller.ts b/apps/sim/triggers/gmail/poller.ts index a168d592d1..0b2a07d876 100644 --- a/apps/sim/triggers/gmail/poller.ts +++ b/apps/sim/triggers/gmail/poller.ts @@ -53,13 +53,6 @@ export const gmailPollingTrigger: TriggerConfig = { description: 'Download and include email attachments in the trigger payload', required: false, }, - includeRawEmail: { - type: 'boolean', - label: 'Include Raw Email Data', - defaultValue: false, - description: 'Include the complete raw Gmail API response in the trigger payload', - required: false, - }, }, outputs: { @@ -117,10 +110,6 @@ export const gmailPollingTrigger: TriggerConfig = { type: 'string', description: 'Event timestamp', }, - rawEmail: { - type: 'json', - description: 'Complete raw email data from Gmail API (if enabled)', - }, }, instructions: [ diff --git a/apps/sim/triggers/microsoftteams/webhook.ts b/apps/sim/triggers/microsoftteams/webhook.ts index 7a83b0a2a4..b4688737d1 100644 --- a/apps/sim/triggers/microsoftteams/webhook.ts +++ b/apps/sim/triggers/microsoftteams/webhook.ts @@ -22,67 +22,45 @@ export const microsoftTeamsWebhookTrigger: TriggerConfig = { }, outputs: { - // Expose the raw Teams message payload at the root for direct access - id: { type: 'string', description: 'Raw message ID' }, - code: { type: 'string', description: 'Code (nullable)' }, + // Top-level valid payloads only from: { id: { type: 'string', description: 'Sender ID' }, name: { type: 'string', description: 'Sender name' }, - role: { type: 'string', description: 'Sender role (nullable)' }, aadObjectId: { type: 'string', description: 'AAD Object ID' }, }, - name: { type: 'string', description: 'Top-level name (nullable)' }, - text: { type: 'string', description: 'Message HTML content' }, - label: { type: 'string', description: 'Label (nullable)' }, - speak: { type: 'string', description: 'Speak (nullable)' }, - value: { type: 'string', description: 'Value (nullable)' }, - action: { type: 'string', description: 'Action (nullable)' }, - locale: { type: 'string', description: 'Locale (e.g., en-US)' }, - summary: { type: 'string', description: 'Summary (nullable)' }, - callerId: { type: 'string', description: 'Caller ID' }, - entities: { type: 'array', description: 'Array of entities (clientInfo, ...)' }, - channelId: { type: 'string', description: 'Channel ID (msteams)' }, - inputHint: { type: 'string', description: 'Input hint (nullable)' }, - listenFor: { type: 'string', description: 'Listen for (nullable)' }, - recipient: { type: 'string', description: 'Recipient (nullable)' }, - relatesTo: { type: 'string', description: 'RelatesTo (nullable)' }, - replyToId: { type: 'string', description: 'Reply to ID (nullable)' }, - timestamp: { type: 'string', description: 'Timestamp' }, - topicName: { type: 'string', description: 'Topic name (nullable)' }, - valueType: { type: 'string', description: 'Value type (nullable)' }, - expiration: { type: 'string', description: 'Expiration (nullable)' }, - importance: { type: 'string', description: 'Importance (nullable)' }, - serviceUrl: { type: 'string', description: 'Service URL' }, - textFormat: { type: 'string', description: 'Text format (plain)' }, - attachments: { type: 'array', description: 'Array of attachments' }, - channelData: { - team: { id: { type: 'string', description: 'Team ID' } }, - tenant: { id: { type: 'string', description: 'Tenant ID' } }, - channel: { id: { type: 'string', description: 'Channel ID' } }, - teamsTeamId: { type: 'string', description: 'Teams team ID' }, - teamsChannelId: { type: 'string', description: 'Teams channel ID' }, + message: { + raw: { + attachments: { type: 'array', description: 'Array of attachments' }, + channelData: { + team: { id: { type: 'string', description: 'Team ID' } }, + tenant: { id: { type: 'string', description: 'Tenant ID' } }, + channel: { id: { type: 'string', description: 'Channel ID' } }, + teamsTeamId: { type: 'string', description: 'Teams team ID' }, + teamsChannelId: { type: 'string', description: 'Teams channel ID' }, + }, + conversation: { + id: { type: 'string', description: 'Composite conversation ID' }, + name: { type: 'string', description: 'Conversation name (nullable)' }, + isGroup: { type: 'boolean', description: 'Is group conversation' }, + tenantId: { type: 'string', description: 'Tenant ID' }, + aadObjectId: { type: 'string', description: 'AAD Object ID (nullable)' }, + conversationType: { type: 'string', description: 'Conversation type (channel)' }, + }, + text: { type: 'string', description: 'Message text content' }, + messageType: { type: 'string', description: 'Message type' }, + channelId: { type: 'string', description: 'Channel ID (msteams)' }, + timestamp: { type: 'string', description: 'Timestamp' }, + }, }, + activity: { type: 'object', description: 'Activity payload' }, conversation: { id: { type: 'string', description: 'Composite conversation ID' }, name: { type: 'string', description: 'Conversation name (nullable)' }, - role: { type: 'string', description: 'Conversation role (nullable)' }, isGroup: { type: 'boolean', description: 'Is group conversation' }, tenantId: { type: 'string', description: 'Tenant ID' }, aadObjectId: { type: 'string', description: 'AAD Object ID (nullable)' }, conversationType: { type: 'string', description: 'Conversation type (channel)' }, }, - deliveryMode: { type: 'string', description: 'Delivery mode (nullable)' }, - membersAdded: { type: 'array', description: 'Members added (nullable)' }, - localTimezone: { type: 'string', description: 'Local timezone' }, - localTimestamp: { type: 'string', description: 'Local timestamp' }, - membersRemoved: { type: 'array', description: 'Members removed (nullable)' }, - reactionsAdded: { type: 'array', description: 'Reactions added (nullable)' }, - semanticAction: { type: 'string', description: 'Semantic action (nullable)' }, - textHighlights: { type: 'string', description: 'Text highlights (nullable)' }, - attachmentLayout: { type: 'string', description: 'Attachment layout (nullable)' }, - historyDisclosed: { type: 'boolean', description: 'History disclosed (nullable)' }, - reactionsRemoved: { type: 'array', description: 'Reactions removed (nullable)' }, - suggestedActions: { type: 'string', description: 'Suggested actions (nullable)' }, }, instructions: [ diff --git a/apps/sim/triggers/outlook/poller.ts b/apps/sim/triggers/outlook/poller.ts index e9181b8bf0..00b0217b84 100644 --- a/apps/sim/triggers/outlook/poller.ts +++ b/apps/sim/triggers/outlook/poller.ts @@ -45,13 +45,6 @@ export const outlookPollingTrigger: TriggerConfig = { description: 'Download and include email attachments in the trigger payload', required: false, }, - includeRawEmail: { - type: 'boolean', - label: 'Include Raw Email Data', - defaultValue: false, - description: 'Include the complete raw Microsoft Graph API response in the trigger payload', - required: false, - }, }, outputs: { @@ -121,10 +114,6 @@ export const outlookPollingTrigger: TriggerConfig = { type: 'string', description: 'Event timestamp', }, - rawEmail: { - type: 'json', - description: 'Complete raw email data from Microsoft Graph API (if enabled)', - }, }, instructions: [