Forum Discussion
jesspoemape
Oct 16, 2023Copper Contributor
Why is Action.Execute returning 209: Invoke Validation Failed. User Forbidden to perform action?
I have a bot that responds to link unfurling with an Adaptive Card with some buttons that fire Action.Execute. When I click the button, the app displays "Something went wrong. Please try again", and in the Network tab I see "Invoke validation failed. User forbidden to perform action".
How do I allow the user to perform the action?
The Action.Execute works as expected in a private chat, but not in a team channel.
This is the relevant part of my app manifest:
"bots": [
{
"botId": REDACTED,
"scopes": [
"personal"
],
"commandLists": [
{
"commands": [
{
"title": "login",
"description": "login to account"
},
{
"title": "logout",
"description": "logout of account"
}
],
"scopes": [
"personal"
]
}
],
"isNotificationOnly": false,
"supportsCalling": false,
"supportsVideo": false,
"supportsFiles": false
}
],
"composeExtensions": [
{
"botId": REDACTED,
"commands": [],
"canUpdateConfiguration": false,
"messageHandlers": [
{
"type": "link",
"value": {
"domains": [REDACTED],
"supportsAnonymizedPayloads": true
}
}
]
}
],
the code to handle the button:
async onAdaptiveCardInvoke(context, invokeValue) {
try {
// The verb "userExecute" is sent from the Adaptive Card defined in adaptiveCards/learn.json
if (invokeValue.action.verb === "userExecute") {
const card = {
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.6",
"body": [
{
"type": "TextBlock",
"size": "Default",
"text": "Adaptive Card-based Loop component Successfully Execute!! ",
"style": "heading"
},
{
"type": "Image",
"url": "https://raw.githubusercontent.com/microsoft/botframework-sdk/master/icon.png",
"height": "auto",
"size": "Medium",
"horizontalAlignment": "left",
"spacing": "None",
"width": "0px"
}
]
};
return {
statusCode: 200,
type: "application/vnd.microsoft.card.adaptive",
value: card
};
}
} catch (err) {
console.log('err: ', err);
const error = new VError({ cause: err }, 'unable to catch invoke activity')
throw error
}
}
My actions:
{
type: 'Action.Execute',
title: 'Show Rich Preview',
style: 'positive',
verb: 'showRichPreviewSubmit',
fallback: 'Action.Submit',
},
{
type: 'Action.Execute',
title: 'Dismiss',
verb: 'showRichPreviewDismiss',
fallback: 'Action.Submit',
},
{
type: "Action.Execute",
title: "Execute!",
verb: "userExecute",
fallback: "Action.Submit"
},
]
- Sayali-MSFTMicrosoftjesspoemape- Thanks for reporting your issue.
We will check this at our end and will get back to you.- Sayali-MSFTMicrosoftjesspoemape-As per the manifest shared by you, you have added the personal scope. Could you please also add the team's scope and double-check it once?
- jesspoemapeCopper Contributor
Sayali-MSFT Ok I added the teams scope, and I am no longer seeing that error. My manifest now looks like this:
"bots": [ { "botId": REDACTED, "scopes": [ "personal", "team" ], "commandLists": [ { "commands": [ { "title": "login", "description": "login to account" }, { "title": "logout", "description": "logout of account" } ], "scopes": [ "personal" ] } ], "isNotificationOnly": false, "supportsCalling": false, "supportsVideo": false, "supportsFiles": false } ], "composeExtensions": [ { "botId": REDACTED, "commands": [], "canUpdateConfiguration": false, "messageHandlers": [ { "type": "link", "value": { "domains": [REDACTED], "supportsAnonymizedPayloads": false } } ] } ],