2

I've developed an app and connector for Microsoft teams, whenever I try to setup a connector for a specific channel and save the connector when the setup is finished there is an unexpected error message

If I then look in the developer tools I see that some request is send to https://outlook.office.com/connectors/ConnectToO365Inline/Manage/UpdateAsync with a http 500 response. I have followed the documentation provided by Microsoft at https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-creating I also stripped down our code to the bare minimum but still get the unexpected error while saving. It's also very odd that the connector works perfectly on our Microsoft partner account, but whenever I try the connector on an other microsoft account it gives the unexpected error while saving.

Here you can see the manifest.json for the app:

{
  "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.11/MicrosoftTeams.schema.json",
  "manifestVersion": "1.11",
  "version": "1.0.0",
  "id": "0fa0f150-fd7e-4c4e-822e-793951af07f6",
  "packageName": "com.package",
  "developer": {
    "name": "App name",
    "websiteUrl": "https://www.domain",
    "privacyUrl": "https://www.domain",
    "termsOfUseUrl": "https://www.domain"
  },
  "name": {
    "short": "short",
    "full": "full"
  },
  "description": {
    "short": "short description",
    "full": "long description"
  },
  "icons": {
    "outline": "icon.png",
    "color": "icon.png"
  },
  "accentColor": "#3F487F",
  "connectors": [
    {
      "connectorId": "8b4fe7a3-a04d-4d60-b204-0519ca2f0d04",
      "configurationUrl": "https://domain/teams/config",
      "scopes": [
        "team"
      ]
    }
  ],
  "permissions": [
    "identity",
    "messageTeamMembers"
  ],
  "validDomains": [
    "domain"
  ]
}

And this is our save handler as part of our file to setup the connector:

    microsoftTeams.settings.registerOnSaveHandler(function (saveEvent) {
        microsoftTeams.getContext(context => {
            microsoftTeams.settings.getSettings(s => {
                let data = {
                    url: s.webhookUrl,
                    name: context.teamName + ' - ' + context.channelName,
                    channel_id: context.channelId,
                    token: s.entityId,
                    origin: window.location.origin
                };

                let xhr = new XMLHttpRequest();
                xhr.open('POST', '/teams/token/updateWebhook');
                xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === 4 && xhr.status === 200) {
                        let response = JSON.parse(xhr.response);
                        if (response.status === true) {
                            context.webhookUrl = response.value;
                            saveEvent.notifySuccess();
                        }
                    }
                }
                xhr.send(JSON.stringify(data));
            });
        });
    });

I already contacted Microsoft support but they said their expertise to developed software and connectors are very little, so we should ask it on Stackoverflow.

What is going wrong, and what do i need to do to make it work?

Gerben
  • 21
  • 4
  • Could you please confirm if you are following below sample? https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/connector-todo-notification/csharp – Nivedipa-MSFT May 18 '22 at 05:49
  • @Nivedipa-MSFT yes I also followed that sample but got the same unexpected error. – Gerben May 18 '22 at 07:49
  • We have created connector from connectors developer dashboard and tested [this](https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/connector-todo-notification/csharp) sample. But it was working fine at our end. Could you please compare the registerOnSaveHandler code with your code if something has missed? – Nivedipa-MSFT May 23 '22 at 11:00
  • @Nivedipa-MSFT It is working on our Microsoft partner account. But whenever i try the to install the app and connector on an other microsoft account it gives the unexpected error while saving. – Gerben May 23 '22 at 14:15
  • Could you please share on which microsoft account you have tested this? – Nivedipa-MSFT May 25 '22 at 07:55
  • @Gerben - Are you using live account like outlook.com or some other account? Can you please share the repro steps for it? – ChetanSharma-msft May 27 '22 at 05:01
  • @ChetanSharma-msft No, we are using onmicrosoft.com. I side-loaded the app and connector to our teams account, and then added the app to a team and setup the connector for a channel. On our partner account (onmicrosoft.com) it works fine, but when i try the exact same steps on any other microsof teams account i get the unexpected error. – Gerben May 30 '22 at 14:40
  • @Gerben - Could you please share the other microsoft account is also onmicrosoft.com where you are getting the error? – Nivedipa-MSFT May 31 '22 at 12:25
  • @Nivedipa-MSFT No the account i'm getting the error is not a onmicrosoft.com. Its with my personal email address. – Gerben Jun 01 '22 at 08:05
  • @Gerben - Could you please share the screen recording? – Nivedipa-MSFT Jun 03 '22 at 06:59

0 Answers0