How to Integrate with Power Automate
Learn how to use the SnackPrompt AI Engine API to build powerful automations and AI-powered flows in Microsoft Power Automate.
Overview
Power Automate (formerly Microsoft Flow) offers several ways to integrate external APIs:
HTTP Action
Direct API calls
Make HTTP requests to any API
Custom Connector
Reusable integration
Create a connector for your organization
AI Builder
AI integration
Combine with Microsoft AI capabilities
Copilot Studio
Chatbots
Build intelligent chatbots with external knowledge
Integration Architecture
┌─────────────────────────────────────────────────────────┐
│ Power Automate │
│ ┌─────────────┐ ┌─────────────┐ ┌────────────┐ │
│ │ Trigger │───▶│ HTTP Action │───▶│ Action │ │
│ └─────────────┘ └──────┬──────┘ └────────────┘ │
│ │ │
│ ┌──────▼──────┐ │
│ │ Parse │ │
│ │ JSON │ │
│ └──────┬──────┘ │
└────────────────────────────┼────────────────────────────┘
│
▼
┌──────────────────────────────┐
│ SnackPrompt AI Engine API │
│ /v1/kb/search or /v1/kb/chat│
└──────────────────────────────┘Method 1: HTTP Action (Recommended)
Use the HTTP action to call the SnackPrompt AI Engine API directly.
Step 1: Create a New Flow
Go to make.powerautomate.com
Click Create > Automated cloud flow or Instant cloud flow
Choose your trigger (e.g., When an email arrives, When an item is created)
Step 2: Add HTTP Action
Click + New step
Search for HTTP
Select HTTP (not HTTP + Swagger)
Step 3: Configure the Request
For Search Endpoint:
Method
POST
URI
https://api-integrations.snackprompt.com/v1/kb/search
Headers:
Content-Type
application/json
x-api-key
@{variables('ApiKey')} or your key
Body:
Step 4: Parse the Response
Add Parse JSON action after HTTP:
Click + New step
Search for Parse JSON
Content: Select the Body from HTTP action
Schema: Click "Generate from sample" and paste:
Step 5: Use the Results
Now you can use the parsed results in subsequent actions:
@{body('Parse_JSON')?['items']}- All items@{first(body('Parse_JSON')?['items'])?['payload']?['original_text']}- First result text
Method 2: Chat Endpoint for Complete Responses
Use the /v1/kb/chat endpoint when you want the API to handle all the RAG.
HTTP Configuration
Method
POST
URI
https://api-integrations.snackprompt.com/v1/kb/chat
Headers:
Content-Type
application/json
x-api-key
YOUR_API_KEY
Body:
Response
The API returns:
answer: Ready-to-use AI responsesources: Sources used to generate the response
Access with: @{body('HTTP')?['answer']}
Method 3: Custom Connector (Reusable)
Create a custom connector for your organization to simplify reuse.
Step 1: Create Custom Connector
Go to Data > Custom connectors
Click + New custom connector > Create from blank
Step 2: General Information
Connector name
SnackPrompt AI Engine
Host
integrations.api.snackprompt.com.br
Base URL
/v1/kb
Step 3: Security
Authentication type
API Key
Parameter label
API Key
Parameter name
x-api-key
Parameter location
Header
Step 4: Definition - Search Action
General:
Summary
Search Knowledge Base
Operation ID
SearchKnowledgeBase
Request:
Method:
POSTURL:
/search
Body Parameters:
query
string
Yes
Search query
tenant_id
string
Yes
Tenant ID
tag_names
array
No
Filter by tags
limit
integer
No
Max results
Step 5: Definition - Chat Action
General:
Summary
Chat with Knowledge Base
Operation ID
ChatWithKnowledgeBase
Request:
Method:
POSTURL:
/chat
Step 6: Create and Test
Click Create connector
Go to Test tab
Create a new connection with your API key
Test both operations
Step 7: Use in Flows
The connector now appears under your custom connectors:
Method 4: Integration with Copilot Studio
Build chatbots that use your knowledge base.
Step 1: Create a Power Automate Flow
Create a flow that can be called from Copilot Studio:
Create Instant cloud flow
Trigger: When Power Virtual Agents calls a flow
Add HTTP action to call SnackPrompt API
Add Return value(s) to Power Virtual Agents
Step 2: Configure Flow
Input from Copilot:
UserQuestion(text) - The user's question
HTTP Action:
Return to Copilot:
Answer:@{body('HTTP')?['answer']}Sources:@{body('HTTP')?['sources']}
Step 3: Connect in Copilot Studio
In your Copilot, create a new Topic
Add Call an action > Select your flow
Pass the user's message
Display the returned answer
Practical Use Cases
1. Email Auto-Responder
Automatically respond to customer emails using knowledge base.
2. Teams Bot Integration
Answer questions posted in Microsoft Teams channels.
3. SharePoint Document Assistant
Automatically find and link related documents.
4. Forms Response Handler
Process form questions and send personalized responses.
5. Scheduled Knowledge Report
Generate weekly reports from knowledge base queries.
6. Multi-Step Support Flow
Working with Variables
Store API Key Securely
Use Environment Variables or Azure Key Vault:
Option 1: Environment Variables
Go to Solutions
Add Environment variable
Name:
SnackPromptApiKeyReference:
@{parameters('SnackPromptApiKey')}
Option 2: Azure Key Vault
Add Azure Key Vault connector
Get secret action
Use secret value in HTTP header
Initialize Variables
At the start of your flow:
Reference in HTTP body:
Configuration Tips
1. Use Expressions for Dynamic Values
2. Handle Empty Results
Add a Condition after Parse JSON:
3. Limit Results for Efficiency
4. Error Handling
Configure Run after settings:
Click ... on the action after HTTP
Select Configure run after
Check has failed to handle errors
Or use Scope with Try-Catch pattern:
5. Apply to Each for Multiple Results
When processing all results:
Complete Example: Support Ticket Automation
Flow Overview
Email arrives with support question
Search knowledge base for answer
If found, send automated reply
If not found, create support ticket in Planner
Step-by-Step
Trigger: When a new email arrives (V3)
Folder: Inbox
Include Attachments: No
Action 1: HTTP
Action 2: Parse JSON
Content:
@{body('HTTP')}Schema: (generate from sample response)
Action 3: Condition
@{length(body('Parse_JSON')?['sources'])}is greater than0
If Yes - Send Email (V2)
To:
@{triggerBody()?['from']}Subject:
Re: @{triggerBody()?['subject']}Body:
@{body('Parse_JSON')?['answer']}
If No - Create Task (Planner)
Title:
Support: @{triggerBody()?['subject']}Details:
@{triggerBody()?['body']}
Expressions Reference
Common Expressions
@{body('HTTP')}
Full HTTP response body
@{body('HTTP')?['answer']}
Answer field from response
@{first(body('Parse_JSON')?['items'])}
First item from array
@{length(body('Parse_JSON')?['items'])}
Count of items
@{join(body('Parse_JSON')?['items'], ', ')}
Join items as string
Working with Arrays
Troubleshooting
Error: "tenant_id is required"
Ensure tenant_id is inside the filters object:
Error: "InvalidJson" in Parse JSON
Check HTTP response is valid JSON
Verify schema matches actual response
Add Compose action before Parse JSON to debug:
Input:
@{body('HTTP')}
HTTP Action Fails
Check URI is correct (no extra spaces)
Verify headers are properly formatted
Test API with Postman first
Check firewall/network access
Empty Results
Verify tenant_id is correct
Remove tag_names filter to search all content
Increase limit parameter
Test query directly in API
Flow Runs Slowly
Reduce limit parameter
Use parallel branches where possible
Consider using async patterns for long operations
Premium vs Standard Licensing
The HTTP action requires a Premium license. Alternatives for Standard:
HTTP Action
✅
Use Custom Connector (also Premium)
Custom Connectors
✅
Request IT to create certified connector
Azure Functions
✅
Azure Functions with Standard trigger
Related
External Resources
Last updated
Was this helpful?