How to Integrate with Zapier
Learn how to use the SnackPrompt AI Engine API to build powerful automations and AI-powered workflows in Zapier.
Overview
Zapier offers several ways to integrate external APIs into your automations:
Webhooks by Zapier
Receive data
Trigger Zaps when external events occur
API Request (Beta)
Direct API calls
Make HTTP requests to any API
Code by Zapier
Advanced processing
Run JavaScript/Python to process data
Chatbots by Zapier
AI conversations
Build chatbots with custom knowledge
Integration Architecture
┌─────────────────────────────────────────────────────────┐
│ Zapier │
│ ┌─────────────┐ ┌─────────────┐ ┌────────────┐ │
│ │ Trigger │───▶│ API Request│───▶│ Action │ │
│ └─────────────┘ └──────┬──────┘ └────────────┘ │
│ │ │
│ ┌──────▼──────┐ │
│ │ Code Step │ │
│ │ (optional) │ │
│ └──────┬──────┘ │
└────────────────────────────┼────────────────────────────┘
│
▼
┌──────────────────────────────┐
│ SnackPrompt AI Engine API │
│ /v1/kb/search or /v1/kb/chat│
└──────────────────────────────┘Method 1: API Request (Recommended)
Use the API Request action to call the SnackPrompt AI Engine API directly.
Step 1: Create a New Zap
Go to zapier.com and click Create Zap
Choose your trigger (e.g., New Email, New Form Submission, Schedule)
Step 2: Add API Request Action
Click + to add a new action
Search for API Request (Beta) or Webhooks by Zapier
Select Custom Request
Step 3: Configure the Request
For Search Endpoint:
Method
POST
URL
https://api-integrations.snackprompt.com/v1/kb/search
Headers:
Content-Type
application/json
x-api-key
YOUR_API_KEY
Body:
Replace {{trigger_field}} with the field from your trigger that contains the search query.
Step 4: Use the Results
The API returns a list of relevant documents. You can use the results in subsequent actions:
Send an email with the information found
Update a CRM record
Post to Slack
Create a support ticket
Method 2: Webhooks by Zapier (Receive Requests)
Use when you want to receive requests and respond with knowledge base information.
Step 1: Create Webhook Trigger
Create a new Zap
Select Webhooks by Zapier as trigger
Choose Catch Hook
Copy the webhook URL provided
Step 2: Add API Request Action
Configure as shown in Method 1, using the data from the webhook:
Body:
Step 3: Return Response (Optional)
If you need to return a response to the webhook caller:
Add Webhooks by Zapier action
Select Return Response
Configure the response body with the API results
Method 3: Chat Endpoint for Complete Responses
Use the /v1/kb/chat endpoint when you want the API to handle all the RAG and return a ready response.
Configuration
URL:
Headers:
Content-Type
application/json
x-api-key
YOUR_API_KEY
Body:
Response
The API returns:
answer: AI-generated response ready to usesources: Sources used to generate the response
Method 4: Code by Zapier (Advanced)
Use when you need to process or transform the API response.
Step 1: Add Code Step
Add Code by Zapier action
Choose Run JavaScript or Run Python
Step 2: JavaScript Example
Input Data:
query: The search query from triggerapi_key: Your API keytenant_id: Your tenant ID
Code:
Step 3: Python Example
Practical Use Cases
1. Email Auto-Responder
Automatically respond to customer emails using knowledge base information.
2. Slack Support Bot
Answer questions posted in a support Slack channel.
3. CRM Enrichment
Automatically attach relevant documentation to new leads based on their inquiry.
4. Form Response Handler
Process form questions and send personalized responses.
5. Scheduled Knowledge Digest
Generate weekly digests of popular topics from your knowledge base.
6. Multi-Step Support Flow
Configuration Tips
1. Store API Key Securely
Use Zapier's Secret Manager or environment variables:
Go to your Zap settings
Add a Secret for your API key
Reference it as
{{secrets.snackprompt_api_key}}
2. Use Filters Wisely
Direct searches with tags when you know the context:
3. Handle Empty Results
Add a Filter or Paths step after the API call:
4. Limit Results for Cost Efficiency
Start with fewer results and increase if needed:
5. Add Error Handling
Use Zapier's built-in error handling:
Click on your API Request step
Go to Advanced Settings
Enable Continue on Error
Add a Paths step to handle errors
Complete Example: Customer Support Automation
Workflow Overview
Customer submits question via form
Zap searches knowledge base
If answer found, send automated reply
If not found, create support ticket
Step-by-Step Setup
Step 1: Trigger - New Form Submission
App: Typeform, Google Forms, or Jotform
Trigger: New Response
Step 2: Action - API Request
URL:
https://api-integrations.snackprompt.com/v1/kb/chatMethod: POST
Headers:
Body:
Step 3: Paths - Check Response Quality
Path A: If
sourcesarray is not emptyPath B: If
sourcesarray is empty
Step 4A: Send Automated Reply
App: Gmail or your email service
To:
{{form_email_field}}Subject:
Re: {{form_subject_field}}Body:
{{api_response_answer}}
Step 4B: Create Support Ticket
App: Zendesk, Freshdesk, or Linear
Create ticket with original question
Troubleshooting
Error: "tenant_id is required"
Make sure tenant_id is inside the filters object:
Error: "Invalid JSON"
Check your JSON body for:
Missing commas between fields
Unescaped quotes in dynamic values
Trailing commas (not allowed in JSON)
Use a Code step to safely construct JSON:
API Returns Empty Results
Verify your
tenant_idis correctCheck if the query matches content in your knowledge base
Try removing
tag_namesfilter to search all contentIncrease the
limitparameter
Zap Runs but No Response
Check the API Request step output in Zap History
Verify the response is being mapped correctly to the next step
Ensure the response fields match what you're referencing
Rate Limiting
If you hit rate limits:
Add a Delay step before API calls
Use Zapier's built-in throttling in Zap settings
Consider batching requests with Looping by Zapier
Zapier AI Integration
Using with Zapier Central (AI)
Zapier Central can use the SnackPrompt API as a data source:
Create an API Connection in Zapier Central
Configure the search endpoint
Ask Central to query your knowledge base
Chatbots by Zapier
Build a chatbot that uses your knowledge base:
Create a new Chatbot
Add a Custom Action that calls the
/chatendpointUse the response as the bot's reply
Related
External Resources
Last updated
Was this helpful?