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

feat: Add support for latest MSTeams webhook URL format #1253

Merged

Conversation

anothermwilson
Copy link
Contributor

@anothermwilson anothermwilson commented Dec 12, 2024

Description:

Related issue (if applicable): #1227

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • No lint errors (use flake8)
  • 100% test coverage

Testing

Anyone can help test this source code as follows:

# Create a virtual environment to work in as follows:
python3 -m venv apprise

# Change into our new directory
cd apprise

# Activate our virtual environment
source bin/activate

# Install the branch
pip install git+https://github.com/anothermwilson/apprise.git@MW-1127-support-msteams-new-webhook-url

# Test out the changes with the following command:
apprise -t "Test MSTeams Latest Webhook URL Format" -b "Test Message" \
  https://yourteam.webhook.office.com/webhookb2/{token_a}/IncomingWebhook/{token_b}/{token_c}/{token_d}

'type': 'string',
'private': True,
'required': False,
'regex': (r'^V2[a-zA-Z0-9-_]+$', 'i'),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern could be relaxed - I have just observed that any new webhook URLs have a token here that starts with V2

# Support Newer Native URLs with 4 tokens, introduced in 2024
('https://myteam.webhook.office.com/webhookb2/{}@{}/IncomingWebhook/{}/{}'
'/{}'
.format(UUID4, UUID4, 'm' * 32, UUID4, 'V2-_' + 'n' * 43), {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the token can contain dashes and underscores

@anothermwilson anothermwilson marked this pull request as ready for review December 12, 2024 15:37
Copy link

codecov bot commented Dec 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.37%. Comparing base (4d21759) to head (6ad013b).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1253   +/-   ##
=======================================
  Coverage   99.37%   99.37%           
=======================================
  Files         148      148           
  Lines       20776    20796   +20     
  Branches     3709     3717    +8     
=======================================
+ Hits        20646    20666   +20     
  Misses        121      121           
  Partials        9        9           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@caronc
Copy link
Owner

caronc commented Dec 15, 2024

This looks great; it appears to be very backwards compatible too! Great job! 🚀

@caronc caronc merged commit 12f8da9 into caronc:master Dec 15, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants