-
-
Notifications
You must be signed in to change notification settings - Fork 528
Add GatewayAPI notification plugin #1430
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
base: master
Are you sure you want to change the base?
Conversation
This commit adds support for GatewayAPI SMS notifications with comprehensive test coverage. Features: - Send SMS notifications via GatewayAPI REST API - Support for multiple target phone numbers - Optional sender/from parameter for branding - Full URL parsing and reconstruction - Proper phone number validation Testing: - Comprehensive URL parsing tests - Edge case handling (invalid numbers, multiple targets) - HTTP response code handling (200, 201, 4xx, 5xx) - Request exception handling - Privacy URL masking 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1430 +/- ##
========================================
Coverage 99.65% 99.65%
========================================
Files 174 175 +1
Lines 22554 22654 +100
Branches 3587 3605 +18
========================================
+ Hits 22476 22576 +100
Misses 70 70
Partials 8 8
🚀 New features to boost your workflow:
|
apprise/plugins/gatewayapi.py
Outdated
| payload = { | ||
| "message": body, | ||
| "recipients.0.msisdn": int(target), | ||
| } |
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.
This is a great start! but when i visit https://gatewayapi.com/docs/apis/rest/#sending-sms-messages, it seems like the payload doesn't align. You're missing quit a few fields. Perhaps you're a developer of the system and know of some un-documented approaches?
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.
I was basing it on the Simple SMS API (HTTP) https://gatewayapi.com/docs/apis/simple/
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.
Fair enough; get it working for you and I can help you with test cases.
- Improve test coverage from 89.79% to 100% - Add sender field validation (alphanumeric 1-11 chars or numeric 1-15 digits) - Add tests for URL parsing, privacy mode, empty targets, and sender validation - Fix test case expectation for mixed valid/invalid targets Test improvements: - test_plugin_gatewayapi_url_parsing: Tests API key in password field, key query param, 'to' param, URL privacy mode - test_plugin_gatewayapi_length_method: Tests __len__() with various target configurations - test_plugin_gatewayapi_url_identifier: Tests url_identifier property - test_plugin_gatewayapi_empty_targets: Tests notification with no targets - test_plugin_gatewayapi_sender_validation: Comprehensive sender field validation tests Security enhancements: - Validates sender against GatewayAPI specifications - Prevents injection via sender field - Gracefully handles invalid senders with warnings 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
…uest Updated the send() method to comply with GatewayAPI's Simple SMS API specification by sending all recipients in a single API request using array indexing (recipients.0.msisdn, recipients.1.msisdn, etc.) instead of making separate API calls for each recipient. Benefits: - Reduced API calls from N (one per recipient) to 1 (single batched request) - Improved efficiency for bulk messaging - Better rate limit utilization - Full conformance with GatewayAPI Simple SMS API specification Updated tests to verify batching behavior and maintained 100% test coverage. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Summary
This PR adds support for GatewayAPI SMS notifications to Apprise.
Features
Implementation Details
apprise/plugins/gatewayapi.pytests/test_plugin_gatewayapi.pygatewayapi://{apikey}@{phone_numbers}from(sender name/number),key(alias for API key),to(additional targets)Testing
Comprehensive test coverage includes:
Test Results
Example Usage
🤖 Generated with Claude Code