mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
fix(teams-wh): fixed teams wh payload (#1119)
* first push * fixed variable res * lint --------- Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net>
This commit is contained in:
@@ -14,7 +14,7 @@ import { useSubBlockStore } from '@/stores/workflows/subblock/store'
|
||||
import { useWorkflowStore } from '@/stores/workflows/workflow/store'
|
||||
import type { BlockState } from '@/stores/workflows/workflow/types'
|
||||
import { getTool } from '@/tools/utils'
|
||||
import { getTriggersByProvider } from '@/triggers'
|
||||
import { getTrigger, getTriggersByProvider } from '@/triggers'
|
||||
|
||||
interface BlockTagGroup {
|
||||
blockName: string
|
||||
@@ -104,8 +104,8 @@ const getOutputTypeForPath = (
|
||||
outputPath: string
|
||||
): string => {
|
||||
if (block?.triggerMode && blockConfig?.triggers?.enabled) {
|
||||
const triggers = getTriggersByProvider(block.type)
|
||||
const firstTrigger = triggers[0]
|
||||
const triggerId = blockConfig?.triggers?.available?.[0]
|
||||
const firstTrigger = triggerId ? getTrigger(triggerId) : getTriggersByProvider(block.type)[0]
|
||||
|
||||
if (firstTrigger?.outputs) {
|
||||
const pathParts = outputPath.split('.')
|
||||
@@ -418,8 +418,10 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
|
||||
}
|
||||
} else {
|
||||
if (sourceBlock?.triggerMode && blockConfig.triggers?.enabled) {
|
||||
const triggers = getTriggersByProvider(sourceBlock.type)
|
||||
const firstTrigger = triggers[0]
|
||||
const triggerId = blockConfig?.triggers?.available?.[0]
|
||||
const firstTrigger = triggerId
|
||||
? getTrigger(triggerId)
|
||||
: getTriggersByProvider(sourceBlock.type)[0]
|
||||
|
||||
if (firstTrigger?.outputs) {
|
||||
// Use trigger outputs instead of block outputs
|
||||
@@ -687,8 +689,10 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
|
||||
} else {
|
||||
const blockState = blocks[accessibleBlockId]
|
||||
if (blockState?.triggerMode && blockConfig.triggers?.enabled) {
|
||||
const triggers = getTriggersByProvider(blockState.type) // Use block type as provider
|
||||
const firstTrigger = triggers[0]
|
||||
const triggerId = blockConfig?.triggers?.available?.[0]
|
||||
const firstTrigger = triggerId
|
||||
? getTrigger(triggerId)
|
||||
: getTriggersByProvider(blockState.type)[0]
|
||||
|
||||
if (firstTrigger?.outputs) {
|
||||
// Use trigger outputs instead of block outputs
|
||||
|
||||
@@ -63,6 +63,18 @@ export class TriggerBlockHandler implements BlockHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (provider === 'microsoftteams') {
|
||||
const providerData = (starterOutput as any)[provider] || webhookData[provider] || {}
|
||||
// Expose the raw Teams message payload at the root for easy indexing
|
||||
const payloadSource = providerData?.message?.raw || webhookData.payload || {}
|
||||
return {
|
||||
...payloadSource,
|
||||
// Keep nested copy for backwards compatibility with existing workflows
|
||||
[provider]: providerData,
|
||||
webhook: starterOutput.webhook,
|
||||
}
|
||||
}
|
||||
|
||||
// Provider-specific early return for Airtable: preserve raw shape entirely
|
||||
if (provider === 'airtable') {
|
||||
return starterOutput
|
||||
|
||||
@@ -22,50 +22,67 @@ export const microsoftTeamsWebhookTrigger: TriggerConfig = {
|
||||
},
|
||||
|
||||
outputs: {
|
||||
type: {
|
||||
type: 'string',
|
||||
description: 'Type of Teams message (e.g., message)',
|
||||
// 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)' },
|
||||
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' },
|
||||
},
|
||||
id: {
|
||||
type: 'string',
|
||||
description: 'Unique message identifier',
|
||||
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' },
|
||||
},
|
||||
input: {
|
||||
type: 'string',
|
||||
description: 'Input message',
|
||||
},
|
||||
timestamp: {
|
||||
type: 'string',
|
||||
description: 'Message timestamp',
|
||||
},
|
||||
localTimestamp: {
|
||||
type: 'string',
|
||||
description: 'Local timestamp of the message',
|
||||
},
|
||||
serviceUrl: {
|
||||
type: 'string',
|
||||
description: 'Microsoft Teams service URL',
|
||||
},
|
||||
channelId: {
|
||||
type: 'string',
|
||||
description: 'Teams channel ID where the event occurred',
|
||||
},
|
||||
from_id: {
|
||||
type: 'string',
|
||||
description: 'User ID who sent the message',
|
||||
},
|
||||
from_name: {
|
||||
type: 'string',
|
||||
description: 'Username who sent the message',
|
||||
},
|
||||
conversation_id: {
|
||||
type: 'string',
|
||||
description: 'Conversation/thread ID',
|
||||
},
|
||||
text: {
|
||||
type: 'string',
|
||||
description: 'Message text content',
|
||||
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: [
|
||||
|
||||
Reference in New Issue
Block a user