“无法保存连接器配置。请重试”错误

时间:2020-07-24 06:58:13

标签: node.js microsoft-teams office365connectors

我正在尝试创建一个MS Teams连接器,这将帮助我向MS Teams通道提供外部实体数据。 我正在按照this blog创建新的连接器。

执行的步骤-

  1. this上注册连接器,并填写所有详细信息。
  2. 在本地托管我的config.html文件,并使用ngrok公开其https链接。
  3. 使用Teams App Studio将连接器安装到Teams。
  4. 在Teams频道上安装了连接器。

确保完成上述所有步骤后,我将连接器安装到MS Teams>频道,并在运行时显示 错误:“无法保存“ cis-connector”连接器配置。请重试。”

屏幕截图-enter image description here

代码库-

config.html文件->

<html>

<head>
    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <title>Page Title</title>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <script src='https://statics.teams.microsoft.com/sdk/v1.2/js/MicrosoftTeams.min.js'></script>
</head>

<body>
    
    Copy your webhook URL from here to POST messages in this channel: <span id="url"></span><br><br>
    Don't forget to click on "Save" to activate your connector.
    <script>
        console.log('into script...');
        //You always have to initialize the teams SDK first before being able to call any other method
        microsoftTeams.initialize();
        //Store some settings in the configuration of the connector
        microsoftTeams.settings.setSettings({
            //Important when referencing your connector from somewhere else within Teams
            entityId: "sampleConn",
            //This name will be shown to channel admins under "configured connectors" - Use something that helps admins to identify this specific connection
            configName: "sampleConfig",
            //The URL to the configuration page for further config changes
            contentUrl: "https://a6b31a2cab1f.ngrok.io"
        });

        //By calling getSettings() you get (among other information) the webhook URL that you will use to POST messages into the channel
        microsoftTeams.settings.getSettings(s => {
            document.getElementById("url").innerText = s.webhookUrl;
            console.log(s);
        });
        
        //Specify what happens when the user clicks on "Save"
        microsoftTeams.settings.registerOnSaveHandler((saveEvent) => {
            //You have to notify Teams that the saving process was successful, otherwise the save operation will time out and display an error
            saveEvent.notifySuccess();
        });

        //This command enables the "Save" button (disabled by default)
        microsoftTeams.settings.setValidityState(true);

        
    </script>
</body>

</html>

index.js代码->

//Create a basic Node.js server
const express = require("express");
const app = express();


app.get("/", (req,res) => {
    //Send out the configuration page of the connector
    res.sendFile(__dirname + "/config.html");
})

app.listen(8080, () => {
    console.log("Server running!");
})

我的manifest.json文件->

{
  "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.7/MicrosoftTeams.schema.json",
  "manifestVersion": "1.7",
  "version": "1.0.0",
  "id": "0591b282-f62f-4977-badc-fad9cff4d7e4",
  "packageName": "com.cis_connector",
  "developer": {
    "name": "Developer",
    "websiteUrl": "https://SomeValidDomainLink.com/index.html",
    "privacyUrl": "https://SomeValidDomainLink.com/privacy-policy.html",
    "termsOfUseUrl": "https://SomeValidDomainLink.com/terms-of-use.html"
  },
  "icons": {
    "color": "color.png",
    "outline": "outline.png"
  },
  "name": {
    "short": "cis-connector",
    "full": "cis_connector"
  },
  "description": {
    "short": "this is a cloud cost alerter",
    "full": "the connector will trigger the app and send daily aws cost spends"
  },
  "accentColor": "#FFFFFF",
  "connectors": [
    {
      "connectorId": "0e9102ad-c7cf-4194-a292-e00f175c2724",
      "configurationUrl": "https://a6b31a2cab1f.ngrok.io/",
      "scopes": [
        "team"
      ]
    }
  ],
  "permissions": [
    "identity",
    "messageTeamMembers"
  ],
  "validDomains": [
    "a6b31a2cab1f.ngrok.io"
  ]
}

问题-上述步骤相当简单,但MS Teams连接器仍显示错误。我可以知道怎么了吗?

0 个答案:

没有答案