Forum Discussion
Getting a 401 when trying to create a conversation
@Euregan - If you're trying to send a proactive message to a Microsoft Teams channel using the Node.js Bot Framework SDK and you're getting a 401 Unauthorized error, it usually means there's a problem with authentication or permissions. Here's a simple checklist to help you troubleshoot:
1.Make sure your bot’s Azure AD app registration has the right Microsoft Graph API permissions. You’ll need:
- ChannelMessage.Send
- Chat.ReadWrite
- Team.ReadBasic.All
- Group.Read.All
These should be application permissions (not delegated), and you must grant admin consent after adding them.
2.In your code, you're using:
MicrosoftAppTenantId: process.env.MS_CLIENT_ID,
This is likely incorrect. The MicrosoftAppTenantId should be your Azure AD tenant ID, not the client ID.
Please let us know if you are still facing this issue after troubleshooting.
Thanks for the swift reply! I can not find the ChannelMessage.Send permission in the application permissions, the only place I see it listed is in the delegated permissions.
I have fixed the tenant id issue, and I'm waiting on my admin to grant the other three permissions to my app.