Forum Discussion
Team Channel: Card with button. Specific URL for each user?
diegoSpace It is not possible to specify different URL's for different users on click of a button. One way you could do this is open a taskmodule and check the user details there and open a url inside task module but that is not a reliable way and is something we do not recommend.
- diegoSpaceFeb 20, 2020Brass Contributor
Gousia_Begum I will try it, just to see if works for me. Why do you don'r recommend it?
As far as I understand in the docu, I must add an 'Action.Submit' in my card, correct? I have that in the card.json sent to the team channel:
"actions": [
{
"type": "Action.Submit",
"title": "Test1",
"data": {
"msteams": {
"type": "invoke",
"value": "{\"key1\": \"value1\", \"key2\": \"value2\"}"
}
}
}
]I receive a post in my bot ("type='invoke'), but is there any method in the API to handle it? Or must I check the 'type' and process then? Now I have that code, and I return a task to open a browser in Teams channel, but no browser is open (I get no error):
onPostReceived(req, res) {
if (req.body == "invoke") {
var task = {
"task": {
type: 'continue',
value: {
width: 500,
height: 200,
title: "site title",
url: myUrl,
fallbackUrl: myUrl
}
}
}res.writeHeader(200, { "Content-Type": "application/json" });
res.write(JSON.stringify(task));
res.end();
}
}What am I doing wrong?
Thanks,
Diego
- Gousia_BegumFeb 28, 2020Former Employee
diegoSpace If you want to open a link in the browser on click of a button you need to use a Action.OpenURL action and if you want to open a task module you will need to pass a invoke action with type as "task/fetch". Please go through TaskModules and try this out.
- diegoSpaceMar 04, 2020Brass Contributor
Gousia_Begum I read the link you mention and according to what I understood there I had the code I pasted before. Is it wrong?
I send to a channel a card, with an action button ("type": "Action.Submit"). When button pressed, my bot receives the HTTP post (message with type 'invoke'), and I responde with a 200 OK (with the task info)
But nothing happens (no popup task is open). Maybe I am not returning properly the Task:
var task = {
"task": {
type: 'continue',
value: {
width: 500,
height: 220,
title: "Test",
url: sUrlNotLogged,
fallbackUrl: sUrlNotLogged
}
}
}res.writeHeader(200, { "Content-Type": "application/json" });
res.write(JSON.stringify(task));
res.end();Or I missunderstood the documentation...
Thanks for your help