fix(teams-wh): fixed teams wh payload#1119
Conversation
There was a problem hiding this comment.
Greptile Summary
This PR fixes variable resolution issues in Microsoft Teams webhook payloads by restructuring how trigger data is accessed and exposed. The changes span three key areas:
Tag Dropdown Component Enhancement: The tag-dropdown.tsx file is updated to use more precise trigger lookup logic. Instead of relying on getTriggersByProvider()[0] which returns the first trigger for a provider type, the component now first checks blockConfig.triggers.available[0] to get the specific configured trigger ID, then uses getTrigger(triggerId) to fetch the exact trigger configuration. This ensures the correct output schema is used when generating variable suggestions for blocks in trigger mode.
Microsoft Teams Trigger Schema Restructuring: The Teams webhook trigger definition in microsoftteams/webhook.ts undergoes a complete schema overhaul. The outputs configuration moves from a simplified flat structure with basic fields like 'type', 'id', and 'input' to a comprehensive nested schema that mirrors the raw Teams webhook payload structure. This includes complex nested objects like 'from', 'channelData', and 'conversation' with all their sub-properties exposed at appropriate levels.
Runtime Payload Handling: The trigger handler adds Microsoft Teams-specific logic that follows the established GitHub webhook pattern. When processing Teams webhooks, it extracts the raw message payload from providerData.message.raw and spreads it at the root level while maintaining backward compatibility by preserving the nested provider structure.
These changes work together to ensure that Teams webhook variables like {from.name} or {conversation.tenantId} can be properly resolved in workflows, addressing the core issue where nested payload properties were previously inaccessible through the variable system.
Confidence score: 3/5
- This PR addresses a legitimate bug but introduces complexity that could affect system stability
- Score reflects concerns about the extensive schema changes and potential data precedence issues in the trigger handler
- Pay close attention to the Microsoft Teams trigger schema changes and trigger handler logic
3 files reviewed, 1 comment
| } | ||
|
|
||
| if (provider === 'microsoftteams') { | ||
| const providerData = (starterOutput as any)[provider] || webhookData[provider] || {} |
There was a problem hiding this comment.
style: Using (starterOutput as any) bypasses TypeScript safety. Consider defining proper types for the webhook data structures.
Context Used: Context - Avoid using type assertions to 'any' in TypeScript. Instead, ensure proper type definitions are used to maintain type safety. (link)
* first push * fixed variable res * lint --------- Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net>
Summary
Fixed the teams wh payload. Variables weren't resolving before.
Type of Change
Testing
Tested across multiple variables and indexing into the payload.
Checklist