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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Office 365 Notification (via Email) Support #229

Merged
merged 7 commits into from May 4, 2020

Conversation

caronc
Copy link
Owner

@caronc caronc commented Apr 13, 2020

Description:

Related issue (if applicable): #225

Syntax:

  • o365://{tenant}:{account_email}/{client_id}/{client_secret}/
  • o365://{tenant}:{account_email}/{client_id}/{client_secret}/{targets}

Notes:

  • If no targets are specified, then the notification is just sent to the address identified by {account_email}
  • Unfortunately the client_secret contains a lot of characters that can drastically conflict with standard URL rules (and thus Apprise might have difficulty detecting your client secret). The ? and @ characters can get generated by Microsoft and will almost definitely cause you issues.
    • Consider encoding this client secret before putting it into your Apprise URL. Encoding the URL can be as simple as just pasting it into the form on this website.
    • You can also just manually escape these characters on your Apprise URL yourself manually (explained here). Simply swap all instances of:
      • ? with %3F
      • @ with %40

Tenant ID, Client ID, and Secret ID Acquisition

You will need to have a valid Microsoft Personal Account AND you will require Administrative access unfortunately (to access the Mail.Send Application Permission). More details can be found here about registering your app with Azure.

But basically it amounts to:

  1. From the Azure Portal go to Microsoft Active Directory -> App Registrations (alt link)
  2. Click new -> give any name (your choice) in Name field -> select personal Microsoft accounts only --> Register
  3. From here (the Overview panel) you can acquire both the Directory (tenant) ID and the Application (`client_id') you will need.
  4. To create your client_secret , go to Active Directory -> Certificate & Tokens -> New client secret
    • The client_secret is an auto-generated string which may have @ and/or ? character(s) in it. You will need to encode these characters to when pasting this into your Apprise URL. See the note section above for more details on how to do this.
  5. Now need to set permission Active directory -> API permissions -> Add permission.
  6. Click on Microsoft Graph
  7. Click on Application Permissions and search for Mail.Send; You will want to check this box too on the match found.
  8. Set the Redirect URI (Web) to the following: https://login.microsoftonline.com/common/oauth2/nativeclient
    1. You can do this from the Authentication -> Add a platform
    2. Choose Web Application.
    3. Enter the URI https://login.microsoftonline.com/common/oauth2/nativeclient
  9. Now you're good to go. 馃檪

New Service Completion Status

  • apprise/plugins/NotifyOffice365.py
  • setup.py
    • add new service into the keywords section of the setup() declaration
  • README.md
    • add entry for new service to table (as a quick reference)
  • packaging/redhat/python-apprise.spec
    • add new service into the %global common_description

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

@codecov-io
Copy link

codecov-io commented Apr 13, 2020

Codecov Report

Merging #229 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            master      #229    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           76        77     +1     
  Lines         8896      9052   +156     
  Branches      1433      1459    +26     
==========================================
+ Hits          8896      9052   +156     
Impacted Files Coverage 螖
apprise/plugins/NotifyEmail.py 100.00% <酶> (酶)
apprise/utils.py 100.00% <酶> (酶)
apprise/plugins/NotifyOffice365.py 100.00% <100.00%> (酶)

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update 9eabae8...c38e238. Read the comment docs.

@caronc caronc force-pushed the 225-office-365-email-support branch from 7efffc8 to 24193ae Compare April 19, 2020 01:42
@caronc caronc force-pushed the 225-office-365-email-support branch 3 times, most recently from 8043282 to 99afe27 Compare April 19, 2020 21:14
@caronc caronc force-pushed the 225-office-365-email-support branch from 7c687eb to 864f66b Compare April 22, 2020 19:34
@caronc caronc force-pushed the 225-office-365-email-support branch from 64ff6c6 to 1359fa2 Compare May 4, 2020 01:10
@caronc caronc force-pushed the 225-office-365-email-support branch from 1359fa2 to c38e238 Compare May 4, 2020 01:10
@caronc caronc merged commit e9452b6 into master May 4, 2020
@caronc caronc deleted the 225-office-365-email-support branch May 7, 2020 15:47
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.

None yet

2 participants