-
-
Notifications
You must be signed in to change notification settings - Fork 445
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
Microsoft Power Automate / Workflows Support #1172
Conversation
824b339
to
deece86
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1172 +/- ##
========================================
Coverage 99.25% 99.26%
========================================
Files 143 144 +1
Lines 18637 18794 +157
Branches 3582 3609 +27
========================================
+ Hits 18499 18656 +157
Misses 126 126
Partials 12 12 ☔ View full report in Codecov by Sentry. |
@stelb I do not have access to MSTeams at this time, can you (or someone you know) can help with the testing? You can use the (`https://) webhook directly provided from the Microsoft workflows (as-is). Apprise should be smart enough to handle it. |
Thanks for this @caronc - I just tried the test code above. Using the So I took the ID and signature from the URL and reformatted them to get: apprise -t "Test Title" -b "Test Message" "workflow://XXXXX/XXXXX"
# 2024-07-22 13:30:46,772 - ERROR - Could not load Workflows (for MSTeams) URL: workflow://3...5/i...U
# 2024-07-22 13:30:46,772 - ERROR - There are no service(s) to notify |
😔 okay, I'll dig deeper when i have some time to focus more on this. I know we're close! The entire framework is in place now, it just needs tweaking. My problem is i don't have a MS Teams setup to test against. I'll keep you posted. Thanks so much for replying and testing so quickly! |
Just tried setting the URL to apprise -t "Test Title" -b "Test Message" `workflows://HOST:PORT/id/signature` |
That's great news! It wouldn't be an Apprise plugin if it didn't also support the actual webhook Without disclosing your credentials, can you share the URL you are using right now (swap some characters to invalidate it - it's the structure I'm interested in). |
Sure - the format is like this (from the "When a Teams webhook request is received" workflow step):
|
I get this when using just the webhook url "https://prod-112.westeurope.logic.azure.com:443/workflows/cc938324.........../triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=giDSp171V8WXL7Sp5Sf35IHu......."
But it was successful anyway. Should 202 be a hint, that there might be some delay? second attempt was delivered immediately. with workflow:id/sig I get "Unsupported URL: workflow:cc938324.........../giDSp171V8WXL7Sp5Sf35IHu......." |
Okay, i pushed another update that should fix the double title being displayed. I also updated the documentation above which will eventually appear in the workflows wiki page (not set up yet). I can't reproduce the issue with the webhooks not working; this appears to work correct, but i did add another test case to ensure it stays this way. Is it possible the webhook didn't work because you fell prey to how URLs can conflict with the Linux Shell? Make sure the webhook is in quotes and it 'should' work. Keep me posted either way. |
Thanks @caronc - just tested it again.
![]() |
"contentUrl": None, | ||
"content": { | ||
"$schema": schema, | ||
"type": "AdaptiveCard", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...realised I only made the comment on the test, so it will need to go here as well:
"type": "AdaptiveCard", | |
"type": "AdaptiveCard", | |
"msteams": { "width": "full" }, |
I saw that and wasn't sure about them, so i took them out. Let me add a test case with them re-added so they can be supported as well. |
@toby-coleman , are the characters escaped for you right out of Azure? Or did you add them? I only ask because in @stelb 's provided example, they weren't escaped. Edit: Anyway, escape support added (and test case to support it) but not sure if it's overkill or not as the effort to sanitize the url adds 4 lines of busy code. Will leave it in place... Created wiki If you guys could check the branch out one last time and give it one more go, i think we're good to merge now. |
5cb39c4
to
d1413db
Compare
@caronc - just tested again and it looks good to me:
Looking again at the URL:
|
Hey! It works with webhook URL and with shorter workflows:// Format now :) I missed the host:port part before for workflows:// I have no issues with escapes, but I remember ohmyzsh messing with my pasted input when I used it. Sometimes useful, sometimes not. |
Glad it's working for you guys! I'm hesitant about the escaping because now this plugin is different from the other 100+ plugins where the Personally, I'm not a fan of that auto-magic-escape feature provided by that shell you shared. You can't even copy and paste terminal commands with it being rearranged/edited on you (this baffles me). Should you ever have to debug your system in the future, online examples you find on the internet may not work (mangled before you press enter). It would make more sense if the shell feature was off by default for all users with an explanation on how to turn it on for the likes of whomever made the request to have it. It basically breaks everything for you (as an administrator). Obviously just my point of view 🙂. I do appreciate you sharing where the escaping came from though; now it makes more sense. I will roll just this one change back (to support broken URLs with escaping) for consistency with the rest of Apprise and other URLs. After that I'll merge. I'll also try to do an official release this weekend so all of this is available in production for you guys. You were all a fantastic help! Thank you sooo much for all your testing and shared links!!🙏🙏 It was so incredibly helpful! |
Agree - doesn't make sense to have this for a single plugin. I never realised it was doing this before today! Thanks so much for getting this PR done quickly so we can all get our Teams notifications working again! |
a4cab97
to
71bd864
Compare
71bd864
to
a448afe
Compare
Description:
Related issue (if applicable): #1161
Added Microsoft Power Automate / Workflows Integration into Apprise.
Known usages:
This plugin can take the Azure Webhook URL as-is (provided after it's generation).
This is in anticipation of the MS Teams Outlook Webhooks being decomissioned in mid Aug/2024
Account Setup
Create a workflow from MS Teams to generate an Azure Webhook. The webhook will look something like this:
Syntax
Valid syntax is as follows:
workflows://{host}:{port}/{workflow}/{signature}
https://prod-NO.LOCATION.logic.azure.com:443/workflows/.....
Parameter Breakdown
sig=
)2016-06-01
. This is also parsed using the keywordapi-version
that can be found on the Azure Webhook Link.{{token}}
curly braces to identify the tokens you wish to have swapped in the provided template prior to it's submission to the upstream service. (e.g{{app_body}}
or{{app_title}}
)Templating
The following tokens can be referenced in provided templates:
{{app_body}}
{{app_title}}
{{app_type}}
info
,warning
,critical
orsuccess
){{app_id}}
Apprise
unless system owner has over-ridden){{app_desc}}
Apprise Notification
unless system owner has over-ridden this){{app_color}}
{{app_type}}
. Hence acritical
message generates a red color here unless the system owner has overridden this.{{app_image_url}}
{{app_url}}
{{app_mode}}
json
New Service Completion Status
%global common_description
Checklist
flake8
)Testing
Anyone can help test this source code as follows: