自定义连接器不起作用“收到来自连接器的错误...”

时间:2019-07-04 15:40:58

标签: outlook microsoft-teams office365connectors

我正在为Microsoft团队开发一个自定义(非常简单)的连接器。当我单击“保存”并出现“连接器错误”但未保存时,我得到了ng错误。

var webhookUrl = '';
var posting = '';
var name = '';
var entity = '';
var url = '';
var context;

microsoftTeams.initialize();
microsoftTeams.settings.getSettings(function(settings) {
    webhookUrl = settings.webhookUrl;
    $("#LINK").html(webhookUrl);
});
microsoftTeams.settings.setValidityState(true);

microsoftTeams.settings.registerOnSaveHandler(function(saveEvent) {
          debugger;
microsoftTeams.getContext(function (context) {
              url = 'http://static-resource-f-o-server.herokuapp.com/index.html';
              entity = "Test-" + context.teamId + "-context.channelId";

          });
microsoftTeams.settings.setSettings({
              entityId : entity,
              contentUrl: url,
              configName : 'test1'
          });
microsoftTeams.settings.getSettings(function(settings) {

            webhookUrl = settings.webhookUrl;
            debugger;


          });
          saveEvent.notifySuccess();
          console.info(webhookUrl);
});


console.info(webhookUrl);

这是我的manifest.json

{
  "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.3/MicrosoftTeams.schema.json",
  "manifestVersion": "1.3",
  "id": "661fda1e-4871-4200-abaa-a24cf8987207",
  "version": "1.0.0",
  "packageName": "com.test1",
  "developer": {
    "name": "Developer",
    "websiteUrl": "http://oktana.io",
    "privacyUrl": "http://oktana.io",
    "termsOfUseUrl": "http://oktana.io"
  },
  "description": {
    "full": "this is a super awesome test",
    "short": "this is an awesome test"
  },
  "icons": {
    "outline": "icon.svg",
    "color": "icon1.svg"
  },
  "connectors": [
    {
      "connectorId": "661fda1e-4871-4200-abaa-a24cf8987207",
      "scopes": [
        "team"
      ],
      "configurationUrl": "https://static-resource-f-o-server.herokuapp.com/index.html"
    }
  ],
  "name": {
    "full": "test1",
    "short": "test1"
  },
  "accentColor": "#FFFFFF",
  "validDomains": [
    "static-resource-f-o-server.herokuapp.com"
  ]
}

我有以下错误

  

2019-07-03T22:33:28.612Z ngClickDecorator:在枚举中找不到值   类型。值:(匿名)@ angular.min.js:112 e.logMessage @   msteams-web-ng1-services.min.js:1 e.error @   msteams-web-ng1-services.min.js:1 E.tryGetEnum @ shared.min.js:1   E.tryGetEnumAttr @ shared.min.js:1 p @ clickDecorators.min.js:1   (匿名)@ clickDecorators.min.js:1 dispatch @ jquery.min.js:1   y.handle @ jquery.min.js:1

     

     

2019-07-03T22:33:28.659Z从连接器收到错误

     

(匿名)@ angular.min.js:112 e.logMessage @   msteams-web-ng1-services.min.js:1 e.error @   msteams-web-ng1-services.min.js:1(匿名)@   lazy-ng1-mod-extensibility-dialogs.js:6110(匿名)@   angular.min.js:154 e @ angular.min.js:40(匿名)@   angular.min.js:43 setTimeout(异步)Zf.k.defer @ angular.min.js:43 f   @ angular.min.js:154 e.processMessage @   lazy-ng1-mod-extensibility-dialogs.js:6071 e @   lazy-ng1-mod-extensibility-dialogs.js:6019

我不知道如何进行。有什么建议吗?

1 个答案:

答案 0 :(得分:0)

您应该调用microsoftTeams.settings.setSettings(),以便完成连接器Webhook注册。

    microsoftTeams.settings.setSettings({
             entityId: "entityId",
             contentUrl: "Your Config URL",
             configName: "configName"
            });

请查看示例Connector setup页面。