title: How to fix : 'Received error from connectors' with Microsoft Teams
body: <p>I am developing a custom connector to teams in a personnal app. When I save it I have this error : "Unable to save "" connector configuration", <br> and this in Console : 
  <a href="https://i.stack.imgur.com/BraSl.png" rel="nofollow noreferrer">Console Error</a>
  I followed the Microsoft sample, here it's the setup.cshtml : </p>
  
  <pre><code>"microsoftTeams.settings.registerOnSaveHandler(function (saveEvent) {
      microsoftTeams.getContext(function (context) {
          url = "https://mydomain.azurewebsites.net/Connector/Setup.cshtml";
          entity = 'connector-officedev-' + context.teamId + '-' + context.channelId;
  
          microsoftTeams.settings.setSettings({
              entityId: entity,
              contentUrl: url,
              configName: entity
          });
      });
      microsoftTeams.settings.getSettings(function (settings) {
          //var webhookUrl = settings.webhookUrl;
          $.ajax({
              url: 'Save',
              type: 'POST',
              contentType: 'application/json',
              data:  JSON.stringify({ urlwebhook :settings.webhookUrl }),
              success: function (data) {
                  $("#webhookUrl").text(data);
                  console.log('webhook created successfully.');
              },
              error: function (errorThrown) {
                  $("#webhookUrl").text("Error");
                  console.log('error', errorThrown);
              }
          });
  
      });
  
      saveEvent.notifySuccess();
  });
  microsoftTeams.settings.registerOnRemoveHandler(function (removeEvent) {
      var removeCalled = true;
  });"
  </code></pre>
  
  <p>I had "<a href="https://mydomain.azurewebsites.net/Connector/Setup.cshtml" rel="nofollow noreferrer">https://mydomain.azurewebsites.net/Connector/Setup.cshtml</a>", in Valid Domains in Connectors Developer Dashboard
  I Don't know why it isn't working
  Thanks for your help</p>
  
  <p><strong>UPDATE 1</strong>
  On the first clic on "Save", there is the error, but on the second clic it's working, and I can send a message to the webhook</p>
  
  <p><strong>UPDATE SOLUTION</strong>
  I find the solution, the saveEvent.notifySucess(); must be in the success function of the ajax call, like that : </p>
  
  <pre><code>$.ajax({
          url: 'Save',
          type: 'POST',
          contentType: 'application/json',
          data:  JSON.stringify({ urlwebhook :settings.webhookUrl }),
          success: function (data) {
              $("#webhookUrl").text(data);
              console.log('webhook created successfully.');
              saveEvent.notifySuccess();
          },
          error: function (errorThrown) {
              $("#webhookUrl").text("Error");
              console.log('error', errorThrown);
              saveEvent.notifyFailure("error");
          }
      });
  </code></pre>
  
  <p>You also need to place a notifySuccess in the RemoveHandler like that : </p>
  
  <pre><code>microsoftTeams.settings.registerOnRemoveHandler(function (removeEvent) {
      var removeCalled = true;
      removeEvent.notifySuccess();
  });
  </code></pre>