Redirect with data object. Here is the code. Presntly it was not working
JavaScript
{
"$schema": ".../schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "TextBlock",
"spacing": "none",
"text": "Click below to authenticate",
"isSubtle": false,
"wrap": true
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Click me for signin",
"data": {
"email":"[email protected]",
"msteams": {
"type": "signin",
"value": "my-lambda-function-url"
}
}
}
]
}
Amira BedhiafiRank #601 · 4K reputationPosted Jan 14, 2025, 8:58 AM EST
Your problem can be with the way the URL is set in the
dataobject, theAction.Submitbutton does not directly handle HTTP redirects; instead, it can send data to a handler (like a bot, a service, or a webhook) to process.Your
Action.Submitcan pass the email and other data to the bot or handler, and then the bot can call the Lambda function URL.Another thing, if your bot or service receives the data, it can then initiate an HTTP request to call the Lambda function URL with the data.
Adaptive Card{ "$schema": ".../schemas/adaptive-card.json", "type": "AdaptiveCard", "version": "1.0", "body": [ { "type": "TextBlock", "spacing": "none", "text": "Click below to authenticate", "isSubtle": false, "wrap": true } ], "actions": [ { "type": "Action.Submit", "title": "Click me for signin", "data": { "email": "[email protected]", "redirectUrl": "my-lambda-function-url" } } ] }// Example handler for the Adaptive Card submission const axios = require('axios'); app.post('/handle-adaptive-card', (req, res) => { const { email, redirectUrl } = req.body.data; // Now make an HTTP request to the Lambda function URL axios.post(redirectUrl, { email: email }) .then(response => { res.status(200).send("Redirect successful"); }) .catch(error => { console.error("Error redirecting:", error); res.status(500).send("Failed to redirect to Lambda function"); }); });