我有一个网页需要在MS Teams的任务模块中显示,我已经使用Bot Framework v4开发了一种解决方案。每当我尝试调用任务模块时,都会出现黑屏。我还已将漫游器URL添加到有效域列表中。
这是应用程序清单(出于保密目的,我更改了azure网站链接。)
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.5/MicrosoftTeams.schema.json",
"manifestVersion": "1.5",
"version": "1.5.0",
"id": "b7b71f97-2521-4e66-b359-9be61930cbdb",
"packageName": "net.azurewebsites.myweb",
"developer": {
"name": "Tech Mahindra ",
"websiteUrl": "https://www.techx.com",
"privacyUrl": "https://www.techx.com/privacy",
"termsOfUseUrl": "https://www.techx.com/termsofuse"
},
"icons": {
"color": "color.png",
"outline": "outline.png"
},
"name": {
"short": "techx QT",
"full": "techx bot"
},
"description": {
"short": "This is techx patient tracker.",
"full": "This application is still in development and any information shown here is just demonstartion purpose."
},
"accentColor": "#8B8B8B",
"bots": [
{
"botId": "3b3f1550-eee6-4c56-91c5-XXXXXXXXX",
"scopes": [
"team",
"personal"
],
"commandLists": [
{
"scopes": [
"team"
],
"commands": [
{
"title": "task",
"description": "task for testing task module"
}
]
}
],
"supportsFiles": true,
"isNotificationOnly": false
}
],
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [
"myweb.azurewebsites.net"
]
}```
***WebPage(PFRPDetailsForm.cshtml) code***
<html>
<head>
<style>
body {
margin: 0;
padding-left: 4px;
padding-right: 4px;
}
</style>
<link href="https://cdn.datatables.net/1.10.15/css/dataTables.bootstrap.min.css" rel="stylesheet" />
<link href="https://cdn.datatables.net/responsive/2.1.1/css/responsive.bootstrap.min.css" rel="stylesheet" />
<link href="~/lib/bootstrap/dist/css/bootstrap.css" rel="stylesheet" />
<title>Microsoft Teams Task Module Tester - Custom Form</title>
</head>
<body>
<script src="@("https://unpkg.com/@microsoft/teams-js@1.6.0/dist/MicrosoftTeams.min.js")"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
microsoftTeams.initialize();
function validateForm() {
microsoftTeams.tasks.submitTask("just for demo");
return true;
}
</script>
<div class="surface theme-light">
<div class="panel">
<div class="font-semibold font-title">Patient Registration Form:</div>
<form method="POST" id="customerForm" onSubmit="return validateForm()">
<div style="width:90%; margin:0 auto;">
<div class="form-group form-field-input" style="margin-bottom: 10px; margin-top: 10px;"></div><label for="fname">First Name: </label><input class="form-control input-field" id="fname" type="text" name="name" tabindex="1" autofocus>
<div class="form-group form-field-input" style="margin-bottom: 10px; margin-top: 10px;"></div><label for="mname">Middle Name: </label><input class="form-control input-field" id="mname" type="text" name="name" tabindex="1" autofocus>
<div class="form-group form-field-input" style="margin-bottom: 10px; margin-top: 10px;"></div><label for="lname">Last Name: </label><input class="form-control input-field" id="mname" type="text" name="name" tabindex="1" autofocus>
<div class="form-group form-field-input" style="margin-bottom: 10px; margin-top: 10px;"></div><label for="sex">SEX : </label><input class="form-control input-field" id="fname" type="text" name="name" tabindex="1" autofocus>
<div class="form-group form-field-input" style="margin-bottom: 10px; margin-top: 10px;"></div><label for="nationality">Nationality: </label><input class="form-control input-field" id="fname" type="text" name="name" tabindex="1" autofocus>
<div class="form-group form-field-input" style="margin-bottom: 10px; margin-top: 10px;"></div><label for="uid">UID: </label><input class="form-control input-field" id="mname" type="text" name="name" tabindex="1" autofocus>
<div class="form-group form-field-input" style="margin-bottom: 10px;"></div><label for="email">Email: </label><input class="form-control input-field" id="email" type="email" placeholder="name@email.com" name="email" tabindex="2">
<div class="form-group form-field-input" style="margin-bottom: 10px;"></div><label for="favoriteBook">Primary Phone Number: </label><input class="form-control input-field" id="pphonenumber" type="text" placeholder="Phone 1" name="phonenumber" tabindex="3">
<div class="form-group form-field-input" style="margin-bottom: 10px;"></div><label for="pw">Secoundary Phone Number: </label><input class="form-control input-field" id="sphonenumber" type="text" placeholder="Phone 2" name="sphonenumber" tabindex="4">
<button class="btn button-primary" style="margin-bottom: 10px; margin-top: 10px;" type="submit" tabindex="5">Next</button>
<button class="btn button-primary" style="margin-bottom: 10px; margin-top: 10px;" type="submit" tabindex="5">Cancel</button>
</div>
</form>
</div>
</div>
</body>
</html>
答案 0 :(得分:1)
我不知道这是否相关,但这是一个可能的建议-当您从消息传递扩展中调用任务模块时,可以使用一个选项指定一个域,用于此目的。即使没有实际的消息扩展名(注册了“撰写扩展名”),也可能需要在清单中填写该部分。看看模式here
其中一部分:
{
"$schema": "https://developer.microsoft.com/json-schemas/teams/v1.5/MicrosoftTeams.schema.json",
...
"composeExtensions": [
{
"botId": "%MICROSOFT-APP-ID-REGISTERED-WITH-BOT-FRAMEWORK%",
"canUpdateConfiguration": true,
"commands": [
...
],
"messageHandlers": [
{
"type" : "link",
"value" : {
"domains" : [
"mysite.someplace.com",
"othersite.someplace.com"
]
}
}
]
}
],
"permissions": [
... ], “ validDomains”:[ “ contoso.com”, “ mysite.someplace.com”, “ othersite.someplace.com” ] })