Workflow API

Updated on March 30, 2026

Trigger Hugo AI Agent or workflows programmatically from your application.

Overview

Hugo can be triggered programmatically in two ways:

Method Description
AI Agent Start a conversation with Hugo's AI agent
Workflow Run a specific workflow scenario

Triggering AI Agent

Trigger the AI agent from your backend with an optional custom instruction:

fetch("https://app.hugo.ai/api/agent/trigger/", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_TOKEN"
  },
  body: JSON.stringify({
    session_id: "SESSION_ID",
    instruction: "Help the user with their refund request"
  })
});
Parameter Type Description
session_id string Required. The Crisp session ID
instruction string Optional. Custom instruction for Hugo (max 2000 chars)

The instruction parameter allows you to provide context-specific guidance to Hugo. For example:

  • "Help the user complete their purchase"
  • "The user is a VIP customer, provide premium support"
  • "Guide the user through the onboarding process"

Hugo will use this instruction alongside its knowledge base to respond appropriately.


Triggering Workflows

Widget SDK

Run a specific workflow from your website:

$crisp.push(["do", "bot:scenario:run", ["WORKFLOW_ID"]]);

Replace WORKFLOW_ID with your workflow's ID (e.g., scenario_a0f5822a-d94c-4545-b63c-3dd869a2ac99).

Example: Trigger on Button Click

<button onclick="$crisp.push(['do', 'bot:scenario:run', ['scenario_a0f5822a-d94c-4545-b63c-3dd869a2ac99']])">
  Start Support Chat
</button>

REST API

Trigger a workflow from your backend:

fetch("https://app.hugo.ai/api/scenario/{workflow_id}/trigger/", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_TOKEN"
  },
  body: JSON.stringify({
    session_id: "SESSION_ID"
  })
});
Keep your token secret. Never expose it in client-side code. The token grants access to your Crisp account and should only be used in server-side code.

Generating Code Snippets

Hugo provides a built-in code generator that creates ready-to-use code snippets in multiple languages:

  1. Open your workflow in Hugo
  2. Click the menu (three dots) in the toolbar
  3. Select Workflow API
  4. Choose your programming language (Node, Python, cURL, PHP, Ruby)
  5. Copy the generated code snippet

The code generator automatically includes your workflow ID and authentication token, so you can paste the code directly into your application.