Skip to content

Conversation

@emmaanuel
Copy link

@emmaanuel emmaanuel commented Sep 26, 2025

Summary

This PR adds a new Chat resource with Create operation to the Microsoft Teams node (v2), allowing users to create both one-on-one and group chats directly from n8n workflows.

What's added:

  • New Chat resource in Microsoft Teams node v2
  • Create operation supporting:
    • One-on-One chats: Between exactly 2 participants
    • Group chats: Multiple participants with optional topic/title
  • Flexible member configuration: Support for User IDs, email addresses, and role assignment (owner/guest)
  • Input validation: Ensures proper member count and chat type constraints
  • Comprehensive test coverage: Unit tests for both chat types

How to test:

  1. Open n8n and create a new workflow
  2. Add a Microsoft Teams node (v2)
  3. Select "Chat" as the resource
  4. Choose "Create" as the operation
  5. Configure:
    • Chat type (One on One / Group)
    • Add at least 2 members with their User IDs/emails and roles
    • For group chats, optionally add a topic
  6. Execute the workflow to create the chat in Microsoft Teams

API Integration:

  • Uses Microsoft Graph API POST /v1.0/chats endpoint
  • Follows Microsoft's official documentation for chat creation
  • Maintains compatibility with existing OAuth2 authentication

Related Linear tickets, Github issues, and Community forum posts

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • follow-up PR created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

Technical Implementation Details:

Files Modified/Created:

  • create.operation.ts - Main operation logic
  • index.ts - Resource descriptions
  • node.type.ts - Type definitions
  • router.ts - Request routing
  • versionDescription.ts - UI configuration

Test Files:

  • create.test.ts
  • create-group.test.ts
  • create.workflow.json
  • create-group.workflow.json

Test Results: ✅ All tests passing (45/45 test suites)

Build Status: ✅ Clean build with no compilation errors

This implementation follows n8n's established patterns and maintains backward compatibility with existing Microsoft Teams node functionality.## Summary

Related Linear tickets, Github issues, and Community forum posts

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@CLAassistant
Copy link

CLAassistant commented Sep 26, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

members: members.map((member) => {
const userBinding = member.userId.includes('@')
? `https://graph.microsoft.com/v1.0/users('${member.userId}')`
: `https://graph.microsoft.com/v1.0/users('${member.userId}')`;
Copy link

Choose a reason for hiding this comment

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

Bug: Redundant Ternary Check Causes Binding Issues

The userBinding ternary operator's branches are identical, making the userId.includes('@') check redundant. Both branches generate the same URL, which may cause incorrect Microsoft Graph API binding if email addresses and user IDs need different formats.

Fix in Cursor Fix in Web

Copy link
Author

Choose a reason for hiding this comment

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

I understand the ternary currently looks redundant, but I kept it on purpose to clearly distinguish the two input cases (userId as email vs. object ID).

According to Microsoft Graph documentation, both identifiers use the same API call format:

For now, both resolve to:

https://graph.microsoft.com/v1.0/users('{user-id-or-upn}')

However, keeping the explicit check makes the code self-documenting and leaves room for potential API differences or future adjustments without refactoring again.
I’d prefer to keep this structure for clarity and maintainability rather than removing it now and possibly re-introducing it later.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 9 files


Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Ask questions if you need clarification on any suggestion

@n8n-assistant n8n-assistant bot added community Authored by a community member node/improvement New feature or request in linear Issue or PR has been created in Linear for internal review labels Sep 26, 2025
@Joffcom
Copy link
Member

Joffcom commented Sep 26, 2025

Hey @emmaanuel,

Thank you for your contribution. We appreciate the time and effort you’ve taken to submit this pull request.

Before we can proceed, please ensure the following:
• Tests are included for any new functionality, logic changes or bug fixes.
• The PR aligns with our contribution guidelines.

Regarding new nodes:
We no longer accept new nodes directly into the core codebase. Instead, we encourage contributors to follow our Community Node Submission Guide to publish nodes independently.

If your node integrates with an AI service that you own or represent, please email [email protected] and we will be happy to discuss the best approach.

About review timelines:
This PR has been added to our internal tracker as "GHC-4680". While we plan to review it, we are currently unable to provide an exact timeframe. Our goal is to begin reviews within a month, but this may change depending on team priorities. We will reach out when the review begins.

Thank you again for contributing to n8n.

@emmaanuel
Copy link
Author

hi @Joffcom,
I’ve double-checked everything and it all looks good to me.
This is my first contribution to n8n, so I hope I didn’t miss anything.
The pr for doc update is here: n8n-io/n8n-docs#3719

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Authored by a community member in linear Issue or PR has been created in Linear for internal review node/improvement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants