feat(notificationChannels): add Plivo SMS and voice channel config form - #2212
feat(notificationChannels): add Plivo SMS and voice channel config form#2212sarveshpatil-plivo wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughAdds Plivo voice and SMS notification channel types, typed request configuration, a conditional configuration form, and localized labels across five locales. ChangesPlivo notification channel
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
actor User
participant NotificationChannelForm
participant Plivo
participant LocaleStrings
User->>NotificationChannelForm: Select Plivo voice or SMS
NotificationChannelForm->>Plivo: Provide request_type and ident
Plivo->>LocaleStrings: Resolve Plivo field labels
Plivo-->>NotificationChannelForm: Render validated configuration fields
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/pages/notificationChannels/pages/Form/Plivo.tsx (1)
16-20: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse Tailwind for conditional container visibility.
Replace the inline display style with conditional
block/hiddenutilities.Proposed fix
- <div - style={{ - display: isPlivo ? 'block' : 'none', - }} - > + <div className={isPlivo ? 'block' : 'hidden'}>As per coding guidelines, use Tailwind utility classes for container layout.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/pages/notificationChannels/pages/Form/Plivo.tsx` around lines 16 - 20, Update the container div in the Plivo form to replace its inline display style with conditional Tailwind classes: apply block when isPlivo is true and hidden otherwise, while preserving the existing visibility behavior.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/pages/notificationChannels/types.ts`:
- Around line 64-74: Update the PlivoRequestConfig interface so answer_url and
answer_method are optional, allowing valid plivo-sms defaults without those
voice-only fields. Restrict answer_method to the literal union 'GET' | 'POST'
while preserving the existing required fields and types.
---
Nitpick comments:
In `@src/pages/notificationChannels/pages/Form/Plivo.tsx`:
- Around line 16-20: Update the container div in the Plivo form to replace its
inline display style with conditional Tailwind classes: apply block when isPlivo
is true and hidden otherwise, while preserving the existing visibility behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: e93b8d0d-b920-4c4c-b829-99e2a917d7b4
⛔ Files ignored due to path filters (1)
public/image/logos/plivo.pngis excluded by!**/*.png
📒 Files selected for processing (9)
src/pages/notificationChannels/constants.tssrc/pages/notificationChannels/locale/en_US.tssrc/pages/notificationChannels/locale/ja_JP.tssrc/pages/notificationChannels/locale/ru_RU.tssrc/pages/notificationChannels/locale/zh_CN.tssrc/pages/notificationChannels/locale/zh_HK.tssrc/pages/notificationChannels/pages/Form/Plivo.tsxsrc/pages/notificationChannels/pages/Form/index.tsxsrc/pages/notificationChannels/types.ts
| interface PlivoRequestConfig { | ||
| auth_id: string; | ||
| auth_token: string; | ||
| src_number: string; | ||
| answer_url: string; | ||
| answer_method: string; | ||
| proxy: string; | ||
| timeout: number; | ||
| retry_times: number; | ||
| retry_sleep: number; | ||
| } |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Make voice-only fields optional.
plivo-sms defaults omit answer_url and answer_method, but this interface requires both. A valid SMS configuration therefore cannot satisfy ChannelItem. Make them optional; constrain answer_method to 'GET' | 'POST'.
Proposed fix
- answer_url: string;
- answer_method: string;
+ answer_url?: string;
+ answer_method?: 'GET' | 'POST';📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| interface PlivoRequestConfig { | |
| auth_id: string; | |
| auth_token: string; | |
| src_number: string; | |
| answer_url: string; | |
| answer_method: string; | |
| proxy: string; | |
| timeout: number; | |
| retry_times: number; | |
| retry_sleep: number; | |
| } | |
| interface PlivoRequestConfig { | |
| auth_id: string; | |
| auth_token: string; | |
| src_number: string; | |
| answer_url?: string; | |
| answer_method?: 'GET' | 'POST'; | |
| proxy: string; | |
| timeout: number; | |
| retry_times: number; | |
| retry_sleep: number; | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/pages/notificationChannels/types.ts` around lines 64 - 74, Update the
PlivoRequestConfig interface so answer_url and answer_method are optional,
allowing valid plivo-sms defaults without those voice-only fields. Restrict
answer_method to the literal union 'GET' | 'POST' while preserving the existing
required fields and types.
|
@710leo Are there any other changes to be made? |
Adds the configuration form for the Plivo SMS and voice notification channels, the companion to the backend PR ccfos/nightingale#3277.
The form follows the typed-config channels such as PagerDuty, so a user fills in only their own values and never a raw URL or JSON body.
Plivo.tsxform undernotificationChannels/pages/Form, with Auth ID, Auth Token as a masked field, and source number. The Answer URL and Answer Method fields appear only for the voice channel, and Answer Method defaults to POST.PlivoRequestConfigand theplivorequest type intypes.ts.plivo-smsandplivo-voicechannels inconstants.tswith the phone contact key and the typedplivo_request_config, plus the Plivo logo under/image/logos/.en_US,zh_CN,zh_HK,ja_JP,ru_RU).Screenshots
Plivo SMS channel form:
Plivo Voice channel form:
Summary by CodeRabbit