-
Notifications
You must be signed in to change notification settings - Fork 20.4k
Description
Question
I'm looking to add phone verification capabilities to the workflow builder that can support multiple verification providers (Plivo, Twilio Verify, Vonage, etc.). This would allow Dify app developers to verify their end-users/customers within AI workflows.
Use Case
Enable workflow builders to:
- Send OTP codes to customers during a workflow
- Verify customer-entered codes before proceeding
- Support both SMS and voice channels for OTP delivery
- Choose their preferred verification provider
Example workflow:
User Input (phone) → Send OTP → Wait for Code → Verify Code → Continue/Reject
Proposed Approaches
Option A: Extensible Verify Tool Category
Create a verify tool category with provider implementations (similar to how model providers work):
api/core/tools/builtin_tool/providers/verify/
├── __init__.py
├── verify_base.py # Base class for verify providers
├── plivo/
│ ├── plivo_verify.yaml
│ ├── plivo_verify.py
│ └── tools/
│ ├── send_otp.yaml
│ ├── send_otp.py
│ ├── verify_otp.yaml
│ └── verify_otp.py
├── twilio/
│ ├── twilio_verify.yaml
│ └── tools/...
└── vonage/
├── vonage_verify.yaml
└── tools/...
This allows:
- Common interface for all verify providers
- Easy addition of new providers
- Users choose provider via credentials configuration
Option B: Plugin per Provider
Create separate plugins for each verification provider:
plugins/plivo_verify/
├── manifest.yaml
└── tools/...
plugins/twilio_verify/
├── manifest.yaml
└── tools/...
Option C: Custom Workflow Node
Create a dedicated verification node type with provider selection:
api/core/workflow/nodes/phone_verify/
├── phone_verify_node.py
├── entities.py
└── providers/
├── plivo.py
├── twilio.py
└── vonage.py
Questions
-
Which approach is recommended for extensible third-party verification services?
-
State management: OTP verification requires storing a session ID between "send" and "verify" steps. What's the recommended way to handle this in workflows?
-
Builtin vs Plugin: For verification provider integrations, is the preference to keep these as external plugins or include as builtin tools with a common interface?
-
Any existing patterns for multi-step verification flows in workflows I should reference?
Would appreciate guidance before implementing. Thanks!