How to Integrate with Pipedream

Learn how to use the SnackPrompt AI Engine API to build powerful automations and AI-powered workflows in Pipedream.

Overview

Pipedream is a developer-focused integration platform with native code support. It offers several ways to integrate APIs:

Method
Use Case
Description

HTTP Request Action

No-code

Simple API calls without coding

Node.js Code Step

Full control

Custom JavaScript/TypeScript code

Python Code Step

Data processing

Python for complex transformations

Custom Component

Reusable

Create shareable integration components

Integration Architecture

┌─────────────────────────────────────────────────────────┐
│                      Pipedream                          │
│  ┌─────────────┐    ┌─────────────┐    ┌────────────┐   │
│  │   Trigger   │──▶│ Code/HTTP    │──▶│   Action   │   │
│  │   Source    │    │    Step     │    │            │   │
│  └─────────────┘    └──────┬──────┘    └────────────┘   │
│                            │                            │
│                     ┌──────▼──────┐                     │
│                     │   $export   │                     │
│                     │   (state)   │                     │
│                     └──────┬──────┘                     │
└────────────────────────────┼────────────────────────────┘


              ┌──────────────────────────────┐
              │  SnackPrompt AI Engine API   │
              │  /v1/kb/search or /v1/kb/chat│
              └──────────────────────────────┘

Pipedream excels at code-based integrations. Use Node.js for full control.

Step 1: Create a New Workflow

  1. Click New > Workflow

  2. Choose your trigger (HTTP, Schedule, App event, etc.)

Step 2: Add Node.js Code Step

  1. Click + to add a step

  2. Select Code > Node.js

  3. Add the code below

Search Knowledge Base

Chat with Knowledge Base


Method 2: HTTP Request Action (No-Code)

For simple integrations without custom code.

Step 1: Add HTTP Request Step

  1. Click + to add a step

  2. Search for HTTP / Webhook

  3. Select Send any HTTP Request

Step 2: Configure Request

Field
Value

Method

POST

URL

https://api-integrations.snackprompt.com/v1/kb/search

Headers:

Key
Value

Content-Type

application/json

x-api-key

{{steps.trigger.event.headers["x-api-key"]}} or configure in Auth

Body:

Step 3: Use Results

Reference in subsequent steps:

  • {{steps.http_request.$return_value.items}}

  • {{steps.http_request.$return_value.items[0].payload.original_text}}


Method 3: Python Code Step

For data scientists or Python-preferred developers.

Search with Python


Method 4: Custom Component (Reusable)

Create a reusable component for your organization.

Create Component

App Definition


Practical Use Cases

1. Webhook-Based Chatbot

2. Slack Bot

3. Email Auto-Responder

4. RAG with OpenAI

5. Scheduled Knowledge Sync


Environment Variables

Store sensitive data in Pipedream environment variables:

  1. Go to Settings > Environment Variables

  2. Add:

    • SNACKPROMPT_API_KEY

    • SNACKPROMPT_TENANT_ID

Access in code:


Configuration Tips

1. Use Props for Configurability

2. Error Handling

3. Data Validation

4. Response Caching

5. Parallel Requests


Troubleshooting

Error: "tenant_id is required"

Ensure tenant_id is inside the filters object:

Error: "Request failed with status 401"

  1. Check API key is correct

  2. Verify API key is not expired

  3. Ensure header name is exactly x-api-key

Empty Results

  1. Verify tenant_id is correct

  2. Remove tag_names filter to search all content

  3. Check query string is not empty

  4. Test API directly with curl

Workflow Times Out

  1. Reduce limit parameter

  2. Add timeout to axios request:

  3. Consider async/webhook pattern for long operations


External Resources

Last updated

Was this helpful?