0
votes

I've configured an outgoing webhook in Microsoft Teams, but @mentioning the webhook name doesn't appear to send a request to the url I've configured.

I have a simple NodeJS server logging all network requests to that endpoint, and I've verified that the url is correct. I've even verified that I can manually send the HTTP POST request to my endpoint the same way the outgoing webhook documentation says to expect it.

In case this might affect anything, the webhook name has spaces in it (my endpoint url does not). My outgoing webhook configuration is similar to the following:

What might I be missing?

2
Could you please try Node.js webhook sample and let us know if it's working for you? You just need to set sharedSecret value in the code which you receive after outgoing webhook configuration. - Wajeed-MSFT
@Wajeed-MSFT Okay, just did that. The only change I made to the sample was setting the sharedSecret. Yet there's still no apparent response when the outgoing webhook is mentioned. Afterward, I made a POST request to the endpoint myself and did receive the response { "type": "message", "text": "Error: message sender cannot be authenticated." }. What should I check from here? - Peter Cassetta
Is it useful for you to know my actual endpoint url? - Peter Cassetta
Please share the endpoint. - Wajeed-MSFT
We can test the endpoint, but what are you typing in Teams to invoke it? - Bill Bliss - MSFT

2 Answers

0
votes

I was following this Mircosoft tutorial on outgoing webhooks and ran into the same issue, which led me here.

After re-creating my webhook and re-setting the project multiple times, I realized my IDE was simply not saving my edits. From what you described, it seems like you might have run into a similar issue.

Bottom line: always follow every step of the tutorial, and you should be good.

0
votes

I had the same problem with a Microsoft Learn module and did the following to debug;

  1. Make sure ngrok is setup correct. In a web-browser open a browser to the URL you setup in Teams, something like https://#########.ngrok.io/api/webhook

    • No response => your ngrok setup is incorrect, check it.
    • Response => ngrok proxy is fine, look at the output of the your server's command line. You should see something like;
      • GET /api/webhook 404 150 - 10.932 ms
  2. Check if Teams is able to connect to your endpoint by sending a message to the Webhook name you setup when adding to Teams. So in Teams enter @WebHookName some message to process. What do you get;

    • Yes - Quick response (less than 5 seconds), but nothing - you are not communicating to the WebHook you setup. Check the Teams team you are using - same as where you setup the hook? Name of hook is correct?
    • Yes - Quick response (less than 5 seconds), but error "Sorry, there was a problem..." - check the console output from your server.
      1. Do you see the POST request - POST /api/webhook 200 1845 - 21.593 ms?
        • No - There is something wrong in your code, Teams is communicating to the webhook running via ngrok fine You are not getting a valid response from your server. Also check that you have updated the security token in your code (/.env)
        • Yes - If you get a quick response (less than 5 seconds), but no output in console - you are connecting to something, just not the server you are running. Check the URL in Teams, it is pointing to something else.
    • Yes - Slow response in Teams with an error (more than 5 seconds) - wait even longer (take a coffee break - 10 minute) and check the console again
      • You see a POST request - semi slow - POST /api/webhook 200 1845 - 100.231 ms - you are good, but your hook is taking too long to reply. Teams requires a response within 5 seconds. Do less.
      • You see a POST request - POST /api/webhook - - - - ms meaning you are hitting your server, but it is timing out - this was the problem I had, turned out I had a return message; where I should have res.send(JSON.stringify(message)); which caused a lock. I need to brush up my JavaScipt...
      • Nothing in console output - If you see nothing, you are not connecting to the correct server or teams cannot communicate to your server, check the URL in Teams.