Skip to content

Question: Best approach for adding phone verification workflow tools (multi-provider support)? #31724

@navi-

Description

@navi-

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

  1. Which approach is recommended for extensible third-party verification services?

  2. State management: OTP verification requires storing a session ID between "send" and "verify" steps. What's the recommended way to handle this in workflows?

  3. 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?

  4. Any existing patterns for multi-step verification flows in workflows I should reference?

Would appreciate guidance before implementing. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    🙋‍♂️ questionThis issue does not contain proper reproduce steps or it only has limited words without details.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions