feat: add Plivo bundle with SMS, voice call, and number lookup components - #14396
feat: add Plivo bundle with SMS, voice call, and number lookup components#14396sarveshpatil-plivo wants to merge 6 commits into
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughAdded Plivo components for SMS delivery, outbound calls, and phone number lookup. Registered the components and Plivo icon in the frontend. Added bundle navigation and documentation. ChangesPlivo integration
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant PlivoSendSMSComponent
participant httpx
participant PlivoAPI
PlivoSendSMSComponent->>httpx: Send authenticated SMS request
httpx->>PlivoAPI: POST SMS payload
PlivoAPI-->>httpx: Return JSON response
httpx-->>PlivoSendSMSComponent: Return response data
Suggested reviewers: Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 3 warnings)
✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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: 6
🤖 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 `@docs/docs/Components/bundles-plivo.mdx`:
- Around line 37-42: Update the Plivo Make Call configuration list to document
the Answer Method setting, keeping GET for the default Answer URL and selecting
POST only when the configured endpoint accepts POST requests.
- Line 35: Update the obsolete Plivo documentation URLs to the current routes:
in docs/docs/Components/bundles-plivo.mdx lines 35-35 and
src/lfx/src/lfx/components/plivo/make_call.py lines 15-15, use the current Calls
route; in docs/docs/Components/bundles-plivo.mdx lines 53-53 and
src/lfx/src/lfx/components/plivo/lookup_number.py lines 15-15, use the current
Lookup Overview route.
In `@src/frontend/src/icons/Plivo/index.tsx`:
- Around line 1-10: Run make format_frontend to format the frontend
TypeScript/React file, then include the formatter-generated changes in the
commit without making unrelated edits.
- Around line 5-10: Update the public props of PlivoIcon to include optional
isDark?: boolean while preserving forwardRef support. Destructure or otherwise
consume isDark before spreading remaining props onto the Plivo SVG so it is not
passed as an unsupported SVG attribute.
In `@src/lfx/src/lfx/components/plivo/make_call.py`:
- Around line 50-59: Update the answer_url field definition in make_call.py to
set required=True, ensuring users cannot clear the URL and build_output() always
sends a valid value for Plivo Create Call requests.
In `@src/lfx/src/lfx/components/plivo/send_sms.py`:
- Around line 34-40: Update the info text on the “src” MessageTextInput to
distinguish Plivo’s supported sender formats: phone numbers use E.164 format,
while short codes and alphanumeric sender IDs do not. Preserve the existing
value, required setting, and field name.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 2513b65b-2cc8-4f15-b3fe-e3804f996d68
⛔ Files ignored due to path filters (1)
src/frontend/src/icons/Plivo/plivo.svgis excluded by!**/*.svg
📒 Files selected for processing (12)
docs/docs/Components/bundles-plivo.mdxdocs/sidebars.jssrc/frontend/src/icons/Plivo/Plivo.jsxsrc/frontend/src/icons/Plivo/index.tsxsrc/frontend/src/icons/eagerIconImports.tssrc/frontend/src/icons/lazyIconImports.tssrc/frontend/src/utils/styleUtils.tssrc/lfx/src/lfx/components/__init__.pysrc/lfx/src/lfx/components/plivo/__init__.pysrc/lfx/src/lfx/components/plivo/lookup_number.pysrc/lfx/src/lfx/components/plivo/make_call.pysrc/lfx/src/lfx/components/plivo/send_sms.py
|
|
||
| ## Plivo Make Call | ||
|
|
||
| The **Plivo Make Call** component places an outbound phone call through the [Plivo Voice API](https://www.plivo.com/docs/voice/api/call?utm_source=github&utm_medium=oss&utm_campaign=langflow-plivo). |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Repair the obsolete Plivo documentation routes.
The Call and Lookup routes used here return 404. The current Calls and Lookup Overview pages are available. ()
docs/docs/Components/bundles-plivo.mdx#L35-L35: replace the Voice API link with the current Calls route.docs/docs/Components/bundles-plivo.mdx#L53-L53: replace the Lookup API link with the current Lookup Overview route.src/lfx/src/lfx/components/plivo/lookup_number.py#L15-L15: update the component documentation URL to the current Lookup Overview route.src/lfx/src/lfx/components/plivo/make_call.py#L15-L15: update the component documentation URL to the current Calls route.
Suggested path updates
-https://www.plivo.com/docs/lookup/api/number
+https://www.plivo.com/docs/lookup/overview
-https://www.plivo.com/docs/voice/api/call
+https://www.plivo.com/docs/voice/api/calls📝 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.
| The **Plivo Make Call** component places an outbound phone call through the [Plivo Voice API](https://www.plivo.com/docs/voice/api/call?utm_source=github&utm_medium=oss&utm_campaign=langflow-plivo). | |
| The **Plivo Make Call** component places an outbound phone call through the [Plivo Voice API](https://www.plivo.com/docs/voice/api/calls?utm_source=github&utm_medium=oss&utm_campaign=langflow-plivo). |
| The **Plivo Make Call** component places an outbound phone call through the [Plivo Voice API](https://www.plivo.com/docs/voice/api/call?utm_source=github&utm_medium=oss&utm_campaign=langflow-plivo). | |
| The **Plivo Lookup Number** component looks up carrier and formatting details for a phone number through the [Plivo Lookup API](https://www.plivo.com/docs/lookup/overview?utm_source=github&utm_medium=oss&utm_campaign=langflow-plivo). |
| The **Plivo Make Call** component places an outbound phone call through the [Plivo Voice API](https://www.plivo.com/docs/voice/api/call?utm_source=github&utm_medium=oss&utm_campaign=langflow-plivo). | |
| documentation: str = "https://www.plivo.com/docs/lookup/overview" |
| The **Plivo Make Call** component places an outbound phone call through the [Plivo Voice API](https://www.plivo.com/docs/voice/api/call?utm_source=github&utm_medium=oss&utm_campaign=langflow-plivo). | |
| documentation: str = "https://www.plivo.com/docs/voice/api/calls" |
📍 Affects 3 files
docs/docs/Components/bundles-plivo.mdx#L35-L35(this comment)docs/docs/Components/bundles-plivo.mdx#L53-L53src/lfx/src/lfx/components/plivo/lookup_number.py#L15-L15src/lfx/src/lfx/components/plivo/make_call.py#L15-L15
🤖 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 `@docs/docs/Components/bundles-plivo.mdx` at line 35, Update the obsolete Plivo
documentation URLs to the current routes: in
docs/docs/Components/bundles-plivo.mdx lines 35-35 and
src/lfx/src/lfx/components/plivo/make_call.py lines 15-15, use the current Calls
route; in docs/docs/Components/bundles-plivo.mdx lines 53-53 and
src/lfx/src/lfx/components/plivo/lookup_number.py lines 15-15, use the current
Lookup Overview route.
| 1. Add the **Plivo Make Call** component to your flow, and then configure it as follows: | ||
|
|
||
| * **Plivo Auth ID** and **Plivo Auth Token**: Enter the credentials for your Plivo account. | ||
| * **From Number**: Enter the caller ID. This is a Plivo phone number in E.164 format. | ||
| * **To Number**: Enter the destination phone number in E.164 format, such as `+14150000001`. | ||
| * **Answer URL**: Enter a publicly reachable URL that returns Plivo answer XML, such as a `<Speak>` element, when the call is answered. A default public URL is provided, so a basic call needs no additional setup. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Document the Answer Method setting.
The component exposes Answer Method with GET and POST, but this section omits it. Add an instruction that keeps GET for the default Answer URL and uses POST only for an endpoint that accepts POST.
Proposed documentation update
* **Answer URL**: Enter a publicly reachable URL that returns Plivo answer XML, such as a `<Speak>` element, when the call is answered. A default public URL is provided, so a basic call needs no additional setup.
+ * **Answer Method**: Keep `GET` for the default Answer URL. Use `POST` only if your custom endpoint accepts 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.
| 1. Add the **Plivo Make Call** component to your flow, and then configure it as follows: | |
| * **Plivo Auth ID** and **Plivo Auth Token**: Enter the credentials for your Plivo account. | |
| * **From Number**: Enter the caller ID. This is a Plivo phone number in E.164 format. | |
| * **To Number**: Enter the destination phone number in E.164 format, such as `+14150000001`. | |
| * **Answer URL**: Enter a publicly reachable URL that returns Plivo answer XML, such as a `<Speak>` element, when the call is answered. A default public URL is provided, so a basic call needs no additional setup. | |
| 1. Add the **Plivo Make Call** component to your flow, and then configure it as follows: | |
| * **Plivo Auth ID** and **Plivo Auth Token**: Enter the credentials for your Plivo account. | |
| * **From Number**: Enter the caller ID. This is a Plivo phone number in E.164 format. | |
| * **To Number**: Enter the destination phone number in E.164 format, such as `+14150000001`. | |
| * **Answer URL**: Enter a publicly reachable URL that returns Plivo answer XML, such as a `<Speak>` element, when the call is answered. A default public URL is provided, so a basic call needs no additional setup. | |
| * **Answer Method**: Keep `GET` for the default Answer URL. Use `POST` only if your custom endpoint accepts POST. |
🤖 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 `@docs/docs/Components/bundles-plivo.mdx` around lines 37 - 42, Update the
Plivo Make Call configuration list to document the Answer Method setting,
keeping GET for the default Answer URL and selecting POST only when the
configured endpoint accepts POST requests.
| import type React from "react"; | ||
| import { forwardRef } from "react"; | ||
| import Plivo from "./Plivo"; | ||
|
|
||
| export const PlivoIcon = forwardRef< | ||
| SVGSVGElement, | ||
| React.PropsWithChildren<{}> | ||
| >((props, ref) => { | ||
| return <Plivo ref={ref} {...props} />; | ||
| }); |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Commit the frontend formatter output.
The autofix job rewrote this file. Run make format_frontend and commit the result so CI does not modify the pull request.
As per coding guidelines, TypeScript and React frontend files must be formatted with make format_frontend.
🧰 Tools
🪛 GitHub Actions: autofix.ci / 0_autofix.txt
[warning] 1-1: autofix-ci detected and applied formatting or autofix changes to this file (5 insertions and 6 deletions).
🪛 GitHub Actions: autofix.ci / autofix
[error] 1-1: Autofix modified this file and committed 5 insertions and 6 deletions. The CI log reports 'Autofix task started.'
🤖 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/frontend/src/icons/Plivo/index.tsx` around lines 1 - 10, Run make
format_frontend to format the frontend TypeScript/React file, then include the
formatter-generated changes in the commit without making unrelated edits.
Sources: Coding guidelines, Pipeline failures
| export const PlivoIcon = forwardRef< | ||
| SVGSVGElement, | ||
| React.PropsWithChildren<{}> | ||
| >((props, ref) => { | ||
| return <Plivo ref={ref} {...props} />; | ||
| }); |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Expose the required isDark icon prop.
PlivoIcon accepts only children, so callers cannot pass isDark. Add isDark?: boolean to the public props. Consume or remove it before spreading SVG attributes.
As per coding guidelines, custom frontend icons must support forwardRef and isDark.
🤖 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/frontend/src/icons/Plivo/index.tsx` around lines 5 - 10, Update the
public props of PlivoIcon to include optional isDark?: boolean while preserving
forwardRef support. Destructure or otherwise consume isDark before spreading
remaining props onto the Plivo SVG so it is not passed as an unsupported SVG
attribute.
Source: Coding guidelines
| name="answer_url", | ||
| display_name="Answer URL", | ||
| info=( | ||
| "URL Plivo fetches for call-flow XML when the call is answered. A default static URL is " | ||
| "provided, so a basic call needs no setup. Override it with your own webhook to customize " | ||
| "what the call says." | ||
| ), | ||
| value="https://s3.amazonaws.com/static.plivo.com/answer.xml", | ||
| required=False, | ||
| ), |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== locate file =="
git ls-files | rg '(^|/)make_call\.py$' || true
echo "== file outline =="
ast-grep outline src/lfx/src/lfx/components/plivo/make_call.py || true
echo "== relevant file sections =="
wc -l src/lfx/src/lfx/components/plivo/make_call.py
sed -n '1,180p' src/lfx/src/lfx/components/plivo/make_call.py
echo "== related Plivo answer_url docs/package references in repo =="
rg -n "answer_url|Create Call|api\.plivo\.com|required=False|required=True" src/lfx/src/lfx/components/plivo || trueRepository: langflow-ai/langflow
Length of output: 6572
🌐 Web query:
Plivo API Create Call answer_url required answer_url parameter
💡 Result:
Yes, the answer_url parameter is a required field when creating an outbound call using the Plivo API [1][2][3][4][5][6]. This parameter specifies the URL that Plivo will invoke via an HTTP request when the outbound call is answered [1]. The response from this URL should contain the Plivo XML (XML) instructions that dictate how the call should be handled (e.g., playing audio, gathering input, or connecting to another party). Across Plivo's official SDKs (including Python, Java,.NET, Node.js, and Ruby), the create method signature consistently includes answer_url as a mandatory argument [1][2][3][4][5][6]. Attempting to initiate a call without providing a valid answer_url will result in an API error [6].
Citations:
- 1: https://github.com/plivo/plivo-examples-python/blob/master/voice/call_api/make_calls.py
- 2: https://github.com/plivo/plivo-python
- 3: https://github.com/plivo/plivo-java/
- 4: https://github.com/plivo/plivo-dotnet
- 5: https://github.com/plivo/plivo-node
- 6: https://www.rubydoc.info/gems/plivo/Plivo/Resources/CallInterface
Require a nonempty answer_url.
answer_url is optional, so users can clear it. build_output() strips the value before sending it, so a cleared configuration still sends an empty answer_url. Plivo requires a valid answer_url for Create Call requests, which makes the request fail instead of using the default in this case. Set required=True on answer_url.
🤖 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/lfx/src/lfx/components/plivo/make_call.py` around lines 50 - 59, Update
the answer_url field definition in make_call.py to set required=True, ensuring
users cannot clear the URL and build_output() always sends a valid value for
Plivo Create Call requests.
| MessageTextInput( | ||
| name="src", | ||
| display_name="From Number", | ||
| info="Sender ID: a Plivo phone number, short code, or alphanumeric sender ID in E.164 format.", | ||
| value=os.getenv("PLIVO_SRC", ""), | ||
| required=True, | ||
| ), |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🌐 Web query:
Plivo SMS sender ID E.164 short code alphanumeric sender ID
💡 Result:
Plivo supports several types of sender IDs for SMS, including numeric (long code) and alphanumeric identifiers [1][2]. The specific requirements and support for these identifiers depend heavily on the destination country and local carrier regulations [1][3]. 1. Numeric Sender IDs: - E.164 Format: When using a numeric sender ID, destination phone numbers (and source numbers when applicable) are typically formatted in E.164 (e.g., +12025551234) [4]. - Short Codes: These are six-digit phone numbers used for high-volume, large-scale messaging [1][2]. Unlike standard long codes, short codes generally have no restrictions on the number of messages you can send per day [1][2]. 2. Alphanumeric Sender IDs: - Definition: These consist of a combination of letters and numbers (e.g., PLIVO) used to identify a brand [1]. - Requirements: They typically range from 6 to 11 characters in length, depending on the destination, and cannot contain spaces or hyphens [1][2]. Specific countries may have unique constraints; for instance, sender IDs for India must consist of exactly six alphabetical characters [1][2]. - Registration: In many regions, alphanumeric sender IDs must be preregistered with local carriers through the Plivo console by submitting a compliance application, which includes details like your use case, sample messages, and company information [1][5][3]. 3. Regional Restrictions: - Important Notice: Alphanumeric sender IDs are not supported in the United States or Canada [1][5]. Messages sent to these destinations must originate from an SMS-enabled Plivo phone number [1][4]. For detailed implementation and registration steps, users should consult the official Plivo documentation and the country-specific requirement lists available in the Plivo support center [1][2][6].
Citations:
- 1: https://plivo.com/docs/messaging/concepts/sender-id-usage
- 2: https://support.plivo.com/hc/en-us/articles/360041448032-Country-Requirements-for-Sender-ID-Registration
- 3: https://support.plivo.com/hc/en-us/articles/360048268191--FAQ-on-Sender-ID
- 4: https://plivo.com/docs/messaging/use-cases/send-an-sms/go
- 5: https://support.plivo.com/hc/en-us/articles/360041360512-Does-Plivo-support-alphanumeric-sender-ID-for-SMS
- 6: https://support.plivo.com/hc/en-us/articles/360041880791-Guide-to-Registering-a-Sender-ID
Correct the sender-format help text.
Short codes and alphanumeric sender IDs are not E.164 values. State that E.164 applies only to phone-number sender IDs. Plivo supports phone numbers, short codes, and alphanumeric sender IDs as separate src formats. (plivo.com)
Proposed fix
- info="Sender ID: a Plivo phone number, short code, or alphanumeric sender ID in E.164 format.",
+ info="Sender ID: a Plivo phone number in E.164 format, a short code, or an alphanumeric sender ID.",📝 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.
| MessageTextInput( | |
| name="src", | |
| display_name="From Number", | |
| info="Sender ID: a Plivo phone number, short code, or alphanumeric sender ID in E.164 format.", | |
| value=os.getenv("PLIVO_SRC", ""), | |
| required=True, | |
| ), | |
| MessageTextInput( | |
| name="src", | |
| display_name="From Number", | |
| info="Sender ID: a Plivo phone number in E.164 format, a short code, or an alphanumeric sender ID.", | |
| value=os.getenv("PLIVO_SRC", ""), | |
| required=True, | |
| ), |
🤖 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/lfx/src/lfx/components/plivo/send_sms.py` around lines 34 - 40, Update
the info text on the “src” MessageTextInput to distinguish Plivo’s supported
sender formats: phone numbers use E.164 format, while short codes and
alphanumeric sender IDs do not. Preserve the existing value, required setting,
and field name.
632761e to
73166bf
Compare
Adds a Plivo bundle exposing send SMS, make call, and number lookup components backed by the Plivo REST API. The bundle ships in the lfx-bundles metapackage (src/bundles/lfx-bundles/src/lfx_bundles/plivo) with a compatibility shim at the former in-tree path, matching the other providers. Signed-off-by: Sarvesh Patil <sarvesh.patil@plivo.com>
Signed-off-by: Sarvesh Patil <sarvesh.patil@plivo.com>
Signed-off-by: Sarvesh Patil <sarvesh.patil@plivo.com>
Signed-off-by: Sarvesh Patil <sarvesh.patil@plivo.com>
Signed-off-by: Sarvesh Patil <sarvesh.patil@plivo.com>
3e8101b to
2c832ed
Compare
Description
This PR adds a Plivo bundle with three components (Send SMS, Make Call, and Lookup Number) backed by the Plivo REST API.
Plivo is a CPaaS provider for SMS and voice, so a flow can send a text, place an outbound call, and look up a number's details without leaving the canvas. The components register under a new Plivo bundle in the sidebar with a Plivo icon.
What's included
src/lfx/src/lfx/components/plivo/(send_sms,make_call,lookup_number), registered in the components package.component_index.jsonis left for CI's autofix workflow (make build_component_index) to regenerate, so the bundle is picked up in production builds without a manual index change.Component notes
PLIVO_SRCwhen it is set.Testing
All three components load in a running langflow and appear under the Plivo bundle.
Verified live against a real Plivo account: Send SMS delivered, Make Call connected and played audio, and Lookup Number returned real carrier data.
Screenshots