Skip to content

fix(teams-wh): fixed teams wh payload#1119

Merged
waleedlatif1 merged 3 commits intostagingfrom
fix/teams-wh
Aug 24, 2025
Merged

fix(teams-wh): fixed teams wh payload#1119
waleedlatif1 merged 3 commits intostagingfrom
fix/teams-wh

Conversation

@aadamgough
Copy link
Contributor

Summary

Fixed the teams wh payload. Variables weren't resolving before.

Type of Change

  • Bug fix

Testing

Tested across multiple variables and indexing into the payload.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Aug 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Aug 23, 2025 7:35pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Aug 23, 2025 7:35pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Edit Code Review Bot Settings | Greptile

}

if (provider === 'microsoftteams') {
const providerData = (starterOutput as any)[provider] || webhookData[provider] || {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@waleedlatif1 waleedlatif1 merged commit bbbf1c2 into staging Aug 24, 2025
5 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/teams-wh branch August 24, 2025 08:03
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
* first push

* fixed variable res

* lint

---------

Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants