Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Dify

Scalekit connector
Open markdown

The Dify connector lets your AI agent act in each user's Dify account. Each user connects their own Dify access token once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 26 tools.

Tools
26
What they doRead · write · destructive
14 · 10 · 214 read10 write2 destructive
Users sign in with

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the Dify connection

    In AgentKit > Connections, create a Dify connection. The name you give it is the connection_name your code passes. See Configure connections.

  4. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'dify'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Dify:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'dify_annotations_list',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user opens the link once and enters their Dify credentials there. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • dify_annotation_reply_status_getGet the status of an annotation reply enable or disable job.Read-only

    Get Annotation Reply Job Status

    Get the status of an annotation reply enable or disable job. Returns job_id, job_status (waiting, processing, completed, error) and error_msg. Use this after dify_annotation_reply_configure.

    Inputs

    actionstringrequired
    The action of the job: enable or disable. Example: enable.one of enabledisable
    job_idstringrequired
    Job ID returned by dify_annotation_reply_configure. Example: b15c8f68-1cf4-4877-bf21-ed7cf2011802.
  • dify_annotations_listList the app's annotations (saved question-answer pairs the app replies with directly when a question matches).Read-only

    List Annotations

    List the app's annotations (saved question-answer pairs the app replies with directly when a question matches). Returns data with each annotation's id, question, answer, hit_count and created_at, plus paging. Use this to find an annotation ID.

    Inputs

    keywordstring
    Only annotations whose question or answer contains this text. Example: refund.
    limitinteger
    Items per page, up to 100. Defaults to 20. Example: 20.
    pageinteger
    Page number. Defaults to 1. Example: 1.
  • dify_app_feedbacks_listList all likes, dislikes and comments on the app's messages, from end users and admins.Read-only

    List App Feedback

    List all likes, dislikes and comments on the app's messages, from end users and admins. Returns data with each feedback's message_id, rating, content, source and created_at. Use this to review answer quality.

    Inputs

    limitinteger
    Items per page. Defaults to 20. Example: 20.
    pageinteger
    Page number. Defaults to 1. Example: 1.
  • dify_app_info_getGet basic information about the Dify app this API key belongs to.Read-only

    Get App Info

    Get basic information about the Dify app this API key belongs to. Returns name, description, tags, mode (chat, agent-chat, advanced-chat, workflow or completion) and author_name. Use this first to know which run tool fits the app.

    Inputs

    This tool takes no inputs.

  • dify_app_meta_getGet the display icons of the tools the app uses.Read-only

    Get App Meta

    Get the display icons of the tools the app uses. Returns tool_icons keyed by tool name. Use this only when you need tool icons.

    Inputs

    This tool takes no inputs.

  • dify_app_parameters_getGet the app's input form and feature settings.Read-only

    Get App Parameters

    Get the app's input form and feature settings. Returns opening_statement, suggested_questions, user_input_form (the input variables with their types and options), file upload limits and feature toggles. Use this to build the inputs object for the run and send tools.

    Inputs

    This tool takes no inputs.

  • dify_app_site_getGet the branding and display settings of the app's hosted web app.Read-only

    Get App Web Settings

    Get the branding and display settings of the app's hosted web app. Returns title, icon, theme color, description, copyright, privacy policy and default language. Use this to mirror the app's branding.

    Inputs

    This tool takes no inputs.

  • dify_conversation_variables_listList the variables stored in a conversation (Chatflow and Chatbot apps).Read-only

    List Conversation Variables

    List the variables stored in a conversation (Chatflow and Chatbot apps). Returns data with each variable's id, name, value_type, value and description, plus has_more. Use this to read conversation memory. Use dify_conversation_variable_update to change a value.

    Inputs

    conversation_idstringrequired
    Conversation ID, from dify_conversations_list or a chat response. Example: 45701982-8118-4bc5-8e9b-64562b4555f2.
    last_idstring
    Paging cursor: the id of the last variable on the previous page. Example: 3c5d7e9f-1a2b-4c6d-8e0f-2a4b6c8d0e1f.
    limitinteger
    Items per page. Defaults to 20. Example: 20.
    userstring
    End-user identifier you choose. Lists only that user's data. Example: user-123.
    variable_namestring
    Only the variable with this name. Example: customer_tier.