我正在设置Microsoft Teams连接器应用程序。我成功上传了manifest.json,并且连接器应用程序显示在应用程序区域中。但是在获取webhook网址后进行配置时,会出现错误无法保存“”连接器配置。请重试。
var host = 'http://example.com';
$(document).ready(function(){
$('#webhookUrl').text('webhookUrl');
// Initialize the Microsoft Teams Library
microsoftTeams.initialize();
microsoftTeams.settings.getSettings(function (settings) {
var webhookUrl = settings.webhookUrl;
$('#webhookUrl').text(webhookUrl);
});
// Set the 'Save' Button state
microsoftTeams.settings.setValidityState(true);
// Save handler when user clicked on Save button
microsoftTeams.settings.registerOnSaveHandler(function (saveEvent) {
microsoftTeams.getContext(function (context) {
var url = host+'/external/msteam/connector';
var entity = 'check-teams-'+context.teamId+'-'+context.channelId;
microsoftTeams.settings.setSettings({
entityId: entity,
contentUrl: url,
configName: 'Check Teams Connector'
});
});
microsoftTeams.settings.getSettings(function (settings) {
var webhookUrl2 = settings.webhookUrl;
$.ajax({
type: 'POST',
dataType: 'json',
url: 'example.com/save/data',
data: {'webhook': webhookUrl2, 'check': 1, 'notify': 1},
success: function (data, status) {
saveEvent.notifySuccess();
$('#debug').text('success');
},
error: function () {
$('#debug').text('error');
saveEvent.notifyFailure('error');
}
});
});
});
microsoftTeams.settings.registerOnRemoveHandler(function (removeEvent) {
var removeCalled = true;
removeEvent.notifySuccess();
});
});