[ZBX-18853] Invalid MS Teams webhook because of new URL synatx Created: 2021 Jan 08  Updated: 2024 Apr 10  Resolved: 2021 Jan 19

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 5.0.7, 5.2.3
Fix Version/s: 5.0.8rc1, 5.2.4rc1, 5.4.0alpha1, 5.4 (plan)

Type: Problem report Priority: Trivial
Reporter: Michael Weber Assignee: Tikhon Uskov (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Zabbix Server: zabbix_server (Zabbix) 5.2.3
Linux Server: Linux XYZ 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64 GNU/Linux
OS-Release: Debian GNU/Linux 10 (buster)
Mysqld: mysqld Ver 10.3.27-MariaDB-0+deb10u1 for debian-linux-gnu on x86_64 (Debian 10)


Issue Links:
Duplicate
duplicates ZBX-19488 Invalid MS Teams webhook Closed
Team: Team INT
Sprint: Sprint 72 (Jan 2021)
Story Points: 0.25

 Description   

Steps to reproduce:

  1. Try to follow the guide: Microsoft Teams monitoring and integration with Zabbix
  2. Based on [Use Microsoft 365 and custom connectors - Microsoft Teams | Microsoft Docs|https://docs.microsoft.com/en-us/microsoftteams/office-365-custom-connectors#add-a-connector-to-a-channel] we get a new webhook URL: https://companyname.webhook.office.com/webhookb2/5bf015e2-ce92-42a8-8e90-92552d6ef161@0c6aa5a3-6531-4e28-9c0b-33ba1a8aa1ff/IncomingWebhook/f7fb2308e5f14431ace5b7cd0e670e42/4563618c-b03b-4e80-b093-28bb4ff11de8
  3. On Zabbix Server add new Media Type Webhook with Paraemter teams_endpoint set to the URL
  4. If you try to test the new media type you get the following message in webinterface: Sending failed: Invalid MS Teams webhook URL: https://<MSTENTANT>.webhook.office.com/webhookb2/586d2828-cb58-48f6-954d-d5de26c29795@0c6aa5a3-6531-4e28-9c0b-33ba1a8aa1ff/IncomingWebhook/bb06d61118274b82bfe4d9<TenRandomDigits>/4563618c-b03b-4e80-b093-28bb4ff11de8

Result:

Unable to send messages to Teams:
Sending failed: Invalid MS Teams webhook URL: https://<MSTENTANT>.webhook.office.com/webhookb2/586d2828-cb58-48f6-954d-d5de26c29795@0c6aa5a3-6531-4e28-9c0b-33ba1a8aa1ff/IncomingWebhook/bb06d61118274b82bfe4d9<TenRandomDigits>/4563618c-b03b-4e80-b093-28bb4ff11de8

Expected:
Send Messages to Teams

Zabbix Forum Link with fix:
Teams Integration - Invalid MS Teams webhook - ZABBIX Forums

Fix:
In source code 

  • zabbix-5.2.x/database/mysql/data.sql modify the 4 entries regarding !params.teams_endpoint.startsWith to !params.teams_endpoint.includes('office.com/webhook'


 Comments   
Comment by Michael Weber [ 2021 Jan 08 ]

Sorry, i screwed it up (saved and cant find the "edit" button for the reported issue). So i add the "Fix" sections here:

Here the "full" Fix that is working for me:

Files: 

  • ./database/mysql/data.sql
  • ./database/sqlite3/data.sql
  • ./database/postgresql/data.sql
  • ./database/oracle/data.sql

Modify the 

 

!params.teams_endpoint.startsWith(''https://outlook.office.com/webhook/'')

to

 

!params.teams_endpoint.includes('office.com/webhook'))

 

If you dont like "incldues" function for JS we could use the "indexOf".

For my setup i used "includes" and the old + new webhook URL syntax is working now!

Old Syntax: https://outlook.office.com/webhook/

"New" Syntax: https://<companyname.webhook.office.com/webhookb2/

Comment by Alexey Pustovalov [ 2021 Jan 11 ]

Hello Michael,

So Microsoft Teams changed URL from https://outlook.office.com/webhook/ to https://<companyname.webhook.office.com/webhookb2/?

Comment by Tikhon Uskov (Inactive) [ 2021 Jan 14 ]

Available in:

Comment by Marina Generalova [ 2021 Jan 19 ]

Documentation updated:

Comment by Roland Anderson [ 2021 Mar 12 ]

I'm still running into this issue in 5.2.5. Do I need to do something more than update from the packages? 

 

Edit: need to make the change in the media type script. Oops. 

Comment by Michael Weber [ 2021 Mar 12 ]

Hi @Tikhon,

i am really sorry, i missed to answer your question. 

We habe some URLs with the "old" syntax https://outlook.office.com/webhook/ and some with the new https//<tentant/company>.webhook.office.com/webhookb2/ , correct.
i cant "test" the fix yet, i am using my workaround. But i will update our Zabbix Server next week an come back with feedback regarding the fix: 

In the Microsoft Teams webhook, hardcoded teams_endpoint check has been removed to prevent URL syntax error.

 

Best regards and thank you for you help!

Comment by Henrik Aronsson [ 2021 Apr 14 ]

Just updated from zabbix-server 5.0.4 to zabbix-server 5.2.6 and this issue is still present. 

Do we need to run some manual change for this?

FYI:

The update from Microsoft is schedule to EOL "old" formats as of 2021-04-11, info from MS:

When this will happen

We will begin transitioning to the new webhook URLs on Monday January 11, 2021; however, existing webhooks URLs will continue to work for three (3) months to allow for migration time.

https://admin.microsoft.com/AdminPortal/Home?#/MessageCenter/:/messages/MC234048

 

Old formats are still working though, but I guess we can expect them to stop working pretty soon.

 

Comment by Vrajesh Mani Raja [ 2021 Apr 19 ]

Hi everyone!

I'm not a Zabbix user but i am facing a similar problem regarding webhooks from the incoming webhook app on MS Teams. Just like Henrik said the old formats stopped working for us last week. What surprised me was that even the new links with the new format <companyname.webhook.office.com> were not working for us. Are the new links working for you guys?

Any amount of googling has not helped me find answers. So i thought id reach out to you guys even if its not strictly the same case.

Kind Regards.

Comment by Tikhon Uskov (Inactive) [ 2021 Apr 19 ]

vrajesh.maniraja Can you show me the error you got?

Comment by Tikhon Uskov (Inactive) [ 2021 Apr 19 ]

Do we need to run some manual change for this?

henrik.aronsson sure. When you update Zabbix, you don't get updates for templates and media types. Download new YAML from GIT and import it.
 

Comment by Vrajesh Mani Raja [ 2021 Apr 19 ]

Maybe a bit of background info: We were using the webhook url on gitlab to get notifications on the teams channel when there was a push event to a project or when an issue was openend.

After we noticed the notifications were not being pushed by the webhook, we set up the url in gitlab again. This is where i got the first error to the effect of - Testing failed. False.

The error on opening the webhook url on browser was:

Invalid webhook request - GET not supported

 

 

Comment by Henrik Aronsson [ 2021 Jun 07 ]

Works out properly for us after updating the media template (we the changes according to this diff: https://git.zabbix.com/projects/ZBX/repos/zabbix/diff/templates/media/msteams/media_msteams.yaml?until=e3e211a5b903f13c47dd7dc6e275b38f4abf415b&at=refs%2Fheads%2Frelease%2F5.2

 

Thanks for your help!

Generated at Sun May 11 08:23:55 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.