OfficeDev / Microsoft-Teams-Samples

Welcome to the Microsoft Teams samples repository. Here you will find task-focused samples in C#, JavaScript and TypeScript to help you get started with the Microsoft Teams App!
MIT License
1.02k stars 777 forks source link

bot still needs to be mentioned to receive meesages even with RSC permissions #753

Closed SlimenTN closed 1 year ago

SlimenTN commented 1 year ago

I want the bot to read messages even without being mentioned, this is my manifest file:

{
    "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.14/MicrosoftTeams.schema.json",
    "manifestVersion": "1.14",
    "version": "1.0.0",
    "id": "{{state.fx-resource-appstudio.teamsAppId}}",
    "packageName": "com.microsoft.teams.extension",
    "developer": {
        "name": "MSTeams, Inc.",
        "websiteUrl": "https://www.example.com",
        "privacyUrl": "https://www.example.com/termofuse",
        "termsOfUseUrl": "https://www.example.com/privacy"
    },
    "icons": {
        "color": "{{config.manifest.icons.color}}",
        "outline": "{{config.manifest.icons.outline}}"
    },
    "name": {
        "short": "{{config.manifest.appName.short}}",
        "full": "{{config.manifest.appName.full}}"
    },
    "description": {
        "short": "{{config.manifest.description.short}}",
        "full": "{{config.manifest.description.full}}"
    },
    "accentColor": "#FFFFFF",
    "bots": [
        {
            "botId": "{{state.fx-resource-bot.botId}}",
            "scopes": [
                "personal",
                "team",
                "groupchat"
            ],
            "supportsFiles": true,
            "isNotificationOnly": false,
            "supportsCalling": false,
            "supportsVideo": false
        }
    ],
    "permissions": [
        "identity",
        "messageTeamMembers"
    ],
    "authorization": {
        "permissions": {
            "resourceSpecific": [
                {
                    "type": "Application",
                    "name": "ChannelMessage.Read.Group"
                },
                {
                    "type": "Application",
                    "name": "ChatMessage.Read.Chat"
                }
            ]
        }
    },
    "validDomains": [
        "{{state.fx-resource-bot.domain}}",
        "token.botframework.com"
    ],
    "webApplicationInfo": {
        "id": "{{state.fx-resource-bot.botId}}",
        "resource": "https://AnyString"
    },
    "devicePermissions": [
        "notifications"
    ]
}

I'm using MSTeams toolkit in VScode to create this bot so the id is being generated by it (I don't have Azure account yet). when lunching the bot locally it works, I can add it to chats and receive messages but if only it was mentioned.

My bot extends the TeamsActivityandler interface:

class TeamsBot extends TeamsActivityHandler {
    this.onMessage(async (context, next) => {
      console.log(context.activity);
   }
}
Prasad-MSFT commented 1 year ago

@SlimenTN - Could you please check with the samples mentioned here and verify if that works? https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/conversations/channel-messages-with-rsc?tabs=channel%2Cdotnet#code-sample FYI, we have tried with below sample and we can receive channel messages with RSC without being @mentioned.

SlimenTN commented 1 year ago

@Prasad-MSFT did you try in chat with someone else or in a channel? when I run it using the local configuration, vscode opens a chrome window with Teams and then open the installation window and instead of clicking on "Add" I click on the small arrow right newt to it and click on "Add to chat" the bot gets added successfully but if I write a message I don't see and when I mention the bot and write a message I receive it!

Prasad-MSFT commented 1 year ago

@SlimenTN - We did try it in channel/group chat scope, and it worked there.

SlimenTN commented 1 year ago

@Prasad-MSFT ok you're right, it works as expected in channels and chat but with someone from the same organization. However, I've tested it in a chat with a guest (not in the same org) it intercept messages only if I mention the bot! does the chat with an extern requires another permission?

Prasad-MSFT commented 1 year ago

We tested by creating chat with guest user and it works there as well without at mentioning the bot. No extra permission needs to be added.

SlimenTN commented 1 year ago

ok thanks I will close this issue

Ajaykumar661 commented 5 months ago

@SlimenTN @Prasad-MSFT I'm still facing the issue, Can you please guide me on this, Any help would be appreciated

Prasad-MSFT commented 4 months ago

@Ajaykumar661 - Could you please let us know what issue you are facing here?