Inngest (integration)

🟒 Smarter AI 🟒

To integrate Inngest with your app and Flowise...

you'll set up Inngest in your code (Node.js/Python), define functions/workflows, connect your app to the Inngest platform (via CLI, cloud integration like Vercel/DO, or manual sync), and then trigger these workflows from your app or Flowise, potentially by invoking Inngest functions directly or sending events, using tools like step.invoke() or event triggers, ensuring your Flowise app calls your Inngest-connected backend to initiate these processes. Here's a step-by-step guide:1. Set Up Inngest in Your Application

  • Install SDK: Add the Inngest SDK to your project (e.g., npm install inngest for Node.js).

  • Create Client: Initialize the Inngest client in your app.

  • Define Functions: Write your background jobs as Inngest functions, using inngest.createFunction().

  • Create an HTTP Endpoint: Set up an HTTP server (e.g., Express, Next.js API route) to serve your Inngest functions, allowing Inngest to communicate with them.

TS Code (typescript)

// Example: Inngest client and function (Node.js)
import { Inngest } from 'inngest';

const inngest = new Inngest({ id: 'my-app-id' });

const myFunction = inngest.createFunction({ name: 'my-workflow' }, async ({ event }) => {
  console.log('Workflow triggered with event:', event);
  // Your logic here, potentially calling Flowise APIs
  return { success: true };
});

// Your HTTP server would expose this function

Connect to Inngest

  • Vercel/DigitalOcean Integration: Use the official marketplace integrations for automatic syncing and deployment management.

  • Manual Sync: If not using an integration, sync manually by providing your app's serve() URL in the Inngest dashboard.

  • Self-hosting CLI: Run npx inngest-cli@latest dev for a local server or inngest start for self-hosting.

Integrate with Flowise

  • Call Your App's API: From Flowise, use a "HTTP Request" node to call an endpoint on your application's backend (the one connected to Inngest).

  • Trigger Inngest from Your App: Your Flowise HTTP call will hit your app, which then:

    • Sends an Event: Triggers an Inngest event (e.g., inngest.send({ name: 'flowise-trigger', data: { ... } })).

    • Invokes a Function Directly: Uses step.invoke() within an existing Inngest function to call another one, breaking down complex logic.

  • Example Flowise HTTP Node:

    • URL: your-app.com (your Inngest HTTP endpoint)

    • Method: POST

    • Body: { "name": "my-flowise-event", "data": { "userId": "123" } }

Orchestration with Inngest

  • Define Workflows: Use Inngest's step.run() or step.invoke() to create complex sequences, parallel tasks, and conditional logic within your functions, coordinating steps like data processing, API calls (including to Flowise), and notifications.

  • State Management: Inngest handles the state, retries, and durable execution, so your workflows don't break if parts fail.

Key Concepts for Flowise/Inngest

  • Inngest as the Orchestrator: Inngest manages the workflow of tasks (e.g., data fetching -> Flowise processing -> data storage).

  • Your App as the Bridge: Your app exposes endpoints that Flowise calls, and your app uses the Inngest SDK to tell Inngest what to do next.

  • step.invoke(): Great for breaking complex workflows into reusable

Last updated

Was this helpful?