Connect
Connects to Microsoft Teams using OAuth2 credentials and establishes a session for subsequent operations.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If ContinueOnError property is true, no error is caught when the project is executed even if Catch node is used.
Output
- Client Id - Unique identifier for the Microsoft Teams connection session. Use this ID with other Teams nodes to perform operations.
Options
- Credentials - OAuth2 credentials document from vault containing:
client_id- Your Azure AD application client IDclient_secret- Your Azure AD application client secrettenant_id- Azure AD tenant ID (defaults to "common" if not specified)access_token- (Auto-managed) Current access tokenrefresh_token- (Auto-managed) Token for refreshing accessexpires_at- (Auto-managed) Token expiration timestamp
How It Works
The Connect node handles the complete OAuth2 authentication flow:
- First-time authentication: If no refresh token exists, opens OAuth2 dialog for user authorization
- Token refresh: If access token is expired but refresh token exists, automatically refreshes the token
- Token reuse: If access token is still valid, reuses it without additional authentication
- Automatic updates: Updates the vault credentials with new tokens automatically
Examples
Basic Connection
Connect to Microsoft Teams and use the client ID for subsequent operations:
// Connect node output
client_id = "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
// Use client_id in other nodes
// No additional authentication needed
Setting Up OAuth2 Credentials
- Create a new credential in your vault (Document category)
- Use the following JSON structure:
{
"client_id": "your_azure_ad_client_id",
"client_secret": "your_azure_ad_client_secret",
"tenant_id": "common"
}
- The Connect node will add these fields automatically:
access_tokenrefresh_tokenexpires_at
Creating Azure AD Application
To get your client credentials:
- Go to Azure Portal
- Navigate to Azure Active Directory > App registrations
- Click "New registration"
- Set redirect URI to
http://localhost:3000/oauth/callback - After creation, note the "Application (client) ID"
- Go to "Certificates & secrets" and create a new client secret
- Add API permissions:
- Microsoft Graph > Delegated permissions
- Add:
Team.ReadBasic.All,Channel.ReadBasic.All,Chat.ReadWrite,ChannelMessage.Send,offline_access
- Grant admin consent for your organization
Tips for Effective Use
- Reuse connections: Store the client ID in a variable to reuse across multiple Teams operations
- Token management: The node automatically handles token refresh - no manual intervention needed
- Vault updates: Credentials in vault are automatically updated with fresh tokens
- Connection pooling: Each Connect creates a new session - use one connection for multiple operations
- Credential security: Store credentials securely in Robomotion vault, never hardcode them
Common Errors and Solutions
"Could not get client_id from credentials"
Cause: The credentials document is missing the client_id field.
Solution: Ensure your vault credential contains a valid client_id field:
{
"client_id": "your_client_id_here",
"client_secret": "your_client_secret_here"
}
"Token refresh failed"
Cause: The refresh token has expired or been revoked.
Solution:
- Delete the
refresh_tokenfield from your credentials - Run Connect again to re-authenticate with OAuth2 dialog
- Ensure your Azure AD application has correct redirect URI
"Failed to get authorization code from OAuth flow"
Cause: OAuth2 dialog was closed or authorization was denied.
Solution:
- Ensure you complete the OAuth2 authorization flow
- Check that user has permissions to access Teams
- Verify redirect URI matches Azure AD app configuration
"ErrAuth: Token exchange failed"
Cause: Invalid client credentials or authorization code.
Solution:
- Verify
client_idandclient_secretare correct - Check that Azure AD application has required API permissions
- Ensure admin consent has been granted for the permissions
Best Practices
- Single connection per flow: Create one connection at the start and reuse the client ID
- Error handling: Use Try-Catch blocks to handle authentication failures gracefully
- Token lifecycle: Let the node manage tokens automatically - don't manually edit token fields
- Secure storage: Always use vault for credentials, never expose in logs or messages
- Testing: Test connection in development before deploying to production
- Monitoring: Log successful connections to track automation runs