Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New MS Teams webhook URL format? #378

Closed
ctflora opened this issue Apr 22, 2021 · 9 comments
Closed

New MS Teams webhook URL format? #378

ctflora opened this issue Apr 22, 2021 · 9 comments
Labels

Comments

@ctflora
Copy link

ctflora commented Apr 22, 2021

The documentation shows an MS Teams webhook URL format that looks like this:
https://team-name.office.com/webhook/{tokenA}/IncomingWebhook/{tokenB}/{tokenC}

However, the URL I just received from the Microsoft "Incoming Webhook" Teams App looks like this:
https://team-name.webhook.office.com/webhookb2/{tokenA}/IncomingWebhook/{tokenB}/{tokenC}

@ctflora
Copy link
Author

ctflora commented Apr 23, 2021

I found this page describing the change:
https://office365itpros.com/2021/02/03/new-format-webhook-url/
Looks like the new format went into effect on April 11th.

@caronc
Copy link
Owner

caronc commented Apr 23, 2021

Sorry for the slow reply; real life has been so busy that i've become a very poor maintainer of this product. 🙁

Thank you for reporting this. I thought I had prepared in advance here for this, but i got the URL's wrong.

I'll try to fix this soon and get a release out for everyone to use.

@caronc caronc added the bug label Apr 23, 2021
@ctflora
Copy link
Author

ctflora commented Apr 23, 2021

No worries! This is an amazing tool, even more so for a side project. Thank you!

@caronc
Copy link
Owner

caronc commented Apr 30, 2021

@ctflora would you be able to test the changes i made on the PR i created? I provided some detailed instructions on how you can just grab that 1 branch. It would be much appreciated to hear another persons feedback before i merge this into the master branch.

@christopherflora
Copy link

The message did not post to Teams, but I think I see the issue. I ran the command line w/ -vvv and noticed that the URL is missing one part. It should have webhook between {team} and office.com\webhookb2.

Here's the URL given me by Teams with my info redacted:
https://{team}.webhook.office.com/webhookb2/{TokenA}/IncomingWebhook/{tokenB}/{TokenC}

And here's the -vvv output:
(apprise) ✘ christopher@main> ~/code/temp/apprise> apprise -vvv -t "Test2" -b "Testing2" "msteams://{team}/{TokenA}/{TokenB}/{TokenC}"

2021-04-30 14:48:02,027 - DEBUG - Loaded MSTeams URL: msteams://{team}/{TokenA}/{TokenB}/{TokenC}/?image=yes&format=markdown&overflow=upstream&rto=4.0&cto=4.0&verify=yes

2021-04-30 14:48:02,027 - INFO - Notifying 1 service(s) asynchronously.

2021-04-30 14:48:02,027 - DEBUG - Using selector: KqueueSelector

2021-04-30 14:48:02,028 - DEBUG - MSTeams POST URL: https://{team}.office.com/webhookb2/{TokenA}/IncomingWebhook/{TokenB}{TokenC} (cert_verify=True)

2021-04-30 14:48:02,028 - DEBUG - MSTeams Payload: {'@type': 'MessageCard', '@context': 'https://schema.org/extensions', 'summary': 'Apprise Notifications', 'themeColor': '#3AA3E3', 'sections': [{'activityImage': 'https://github.com/caronc/apprise/raw/master/apprise/assets/themes/default/apprise-info-72x72.png', 'activityTitle': 'Test2', 'text': 'Testing2'}]}

2021-04-30 14:48:02,036 - WARNING - A Connection error occurred sending MSTeams notification.

2021-04-30 14:48:02,036 - DEBUG - Socket Exception: HTTPSConnectionPool(host='{team}.office.com', port=443): Max retries exceeded with url: /webhookb2/{TokenA}/IncomingWebhook/{TokenB}/{TokenC} (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x1072ee100>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))

@caronc
Copy link
Owner

caronc commented Apr 30, 2021

The message did not post to Teams, but I think I see the issue. I ran the command line w/ -vvv and noticed that the URL is missing one part. It should have webhook between {team} and office.com\webhookb2.

Great catch! 👍 Thank you! I just pushed a fix to that.

@christopherflora
Copy link

That did the trick!!

Here's the -vvv output if you wanted to take a look:

apprise -vvv -t "Test2" -b "Testing2" "msteams://{team}/{TokenA}/{TokenB}/{TokenC}" 2021-04-30 16:44:22,485 - DEBUG - Loaded MSTeams URL: msteams://{team}/{TokenA}/{TokenB}/{TokenC}/?image=yes&format=markdown&overflow=upstream&rto=4.0&cto=4.0&verify=yes

2021-04-30 16:44:22,485 - INFO - Notifying 1 service(s) asynchronously.

2021-04-30 16:44:22,485 - DEBUG - Using selector: KqueueSelector

2021-04-30 16:44:22,486 - DEBUG - MSTeams POST URL: https://{team}.webhook.office.com/webhookb2/{TokenA}/IncomingWebhook/{TokenB}/{TokenC} (cert_verify=True)

2021-04-30 16:44:22,486 - DEBUG - MSTeams Payload: {'@type': 'MessageCard', '@context': 'https://schema.org/extensions', 'summary': 'Apprise Notifications', 'themeColor': '#3AA3E3', 'sections': [{'activityImage': 'https://github.com/caronc/apprise/raw/master/apprise/assets/themes/default/apprise-info-72x72.png', 'activityTitle': 'Test2', 'text': 'Testing2'}]}

2021-04-30 16:44:24,145 - INFO - Sent MSTeams notification.

@caronc
Copy link
Owner

caronc commented Apr 30, 2021

Thank you so much for your efforts! I really appreciate it. I'm having troubles with the CI right now, I just polled the Travis-CI community for help (source) and created a PR #381 .

I just want to get everything building again so the proper tests run (as i know they should pass here without any problems). But as soon as i get that resolved (and can merge it back with the MSTeams ticket), i'll push it upstream. Sorry for the delay.

Again, thanks for your help testing and for such incredibly speedy replies!

@caronc
Copy link
Owner

caronc commented May 2, 2021

Thanks again for all your help; this branch has been merged into the master. I'm closing off the ticket now.

@caronc caronc closed this as completed May 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants