feat(sender): add Plivo as a SMS and voice alert-notification provider - #3277
feat(sender): add Plivo as a SMS and voice alert-notification provider#3277sarveshpatil-plivo wants to merge 1 commit into
Conversation
2a26954 to
b7b8229
Compare
Add Plivo as a notification provider with two channels, plivo-sms and plivo-voice. Both use a typed PlivoRequestConfig that stores only the user-specific values (auth id, auth token, source number, and for voice the answer url and method), while the endpoint, method and request body are built in code. Register the channels in alert/sender/provider/init.go and seed the default Chinese and English templates in models/message_tpl.go.
b7b8229 to
4110123
Compare
|
Thanks for the follow-up on #3271 — the backend part looks reasonable, especially moving to a dedicated Before we can merge this, three things are still missing: 1. The frontend PR A new notification channel isn't usable until the config form exists in the console. Since
Please link the two PRs to each other so they can be reviewed and merged together. 2. User-facing documentation A short usage guide for operators: where to get the Auth ID / Auth Token / source number from the Plivo console, what the Answer URL is and how to host one for 3. An end-to-end test report from within Nightingale The screenshots you attached show delivery from the Plivo console, which proves the API call works, but not that the channel works through the product. Could you add a report covering the full path:
Both Once those are in place we'll do another round of review. Thanks for the contribution! |
|
@710leo Apologies for the delay in getting the frontend PR up. It's now open at n9e/fe#2212, and I've updated this PR to address your review. Short summary of what's in place:
Happy to adjust anything. Thanks for the thorough review. |
|
@710leo Are there any other changes to be made? |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Adds Plivo as a notification provider with two channels, so nightingale can deliver alerts over SMS and voice.
plivo-smssends the rendered alert content as a text message through the Plivo Messages API.plivo-voiceplaces an outbound call through the Plivo Calls API using a configured Answer URL.Following the review on #3271, the config is a dedicated typed
PlivoRequestConfig(likePagerDutyRequestConfig) rather than the generic HTTP request config. The stored config holds only user-specific values, which are the Auth ID, Auth Token, source number, and for voice the Answer URL. The endpoint, method, and request body are built in code. Authentication uses Plivo HTTP Basic auth built from the Auth ID and Auth Token.The two channels are registered in
alert/sender/provider/init.go, and default templates in both Chinese and English are seeded inmodels/message_tpl.go.Which issue(s) this PR fixes:
Fixes #3271
Companion frontend PR:
The channel configuration form is in n9e/fe#2212.
Special notes for your reviewer:
The provider package builds, passes
go vet, and the existing provider tests pass.End-to-end test through the product: I verified both channels through Nightingale's real notification pipeline, not just the raw Plivo API. Each alert event was routed through a notification rule bound to the Plivo channel, and the send result was recorded in the console. Note that the alert event was injected through the event API rather than fired from a metric alert rule, because the test instance has no metrics datasource; everything downstream (notify-rule matching, channel send, notification record) is the real product path.
Channel config form, SMS:
Channel config form, Voice (Answer URL and Answer Method appear only for voice):
plivo-sms, event routed through the notification rule:
plivo-sms, notification record with status success (Plivo returned 202, message queued):
plivo-voice, notification record with status success (Plivo returned 201, call queued):
Received SMS delivered (Plivo console message insights, status Delivered):
Voice call answered (Plivo console call insights):
Failure case with a wrong Auth Token, the Plivo 401 is surfaced in the notification record rather than swallowed:
Implementation notes:
+, so an operator may enter either+14155551234or14155551234. Building the body in code also avoids the HTML escaping that the generic template renderer would apply to+.