What You’ll Build
A complete API and webhook integration with:- A webhook endpoint to receive external data
- Custom code processing for data transformation
- AI-powered text summarization using an Agent Creator agent (called via the Agent Factory App)
- Seamless event-driven communication between components
Prerequisites
Before starting this tutorial, make sure you have:- An active Prisme.ai account
- The Agent Factory App installed in your workspace (search for “Agent Factory App” in the marketplace; its automation namespace is
Agents) - An Agent Factory API key generated in Agent Creator (open any agent → Settings → API Keys) and pasted into the Agent Factory App’s configuration field
apiKeyafter installing it. This is required for the webhook to call the agent from an unauthenticated request — without it,Agents.sendMessagereturns401 UNAUTHORIZED. - The Custom Code app installed in your workspace
- An agent created in the Agent Creator product, configured with the system instructions you want for the summary task
Step 1: Creating Your Workspace
Let’s start by setting up a dedicated workspace for our webhook integrations:Open Builder
/builder.Create a New Workspace

Configure Workspace Settings
- Name: “AI API Integrator” (or a name of your choice)
- Description: a short summary of the workspace purpose


Step 2: Creating the Summary Generation Automation
First, let’s create the automation that will use AI to generate summaries from JSON data. The actual summarization prompt lives on the agent itself in Agent Creator — this automation only forwards the user message.Navigate to Automations
Create a New Automation
- Name: “Generate Summary”
- Slug: “generate-summary”
Configure the Automation
Save the Automation
json() utility function because language models expect text input, not structured JSON.Agents.sendMessage returns an A2A task object. The model’s reply is at agentResponse.task.output.messages[0].parts[0].text — that’s the path used in the output: line above. The full task object also contains usage (tokens, cost), task.id, and task.contextId (useful if you want to continue the conversation by passing it back as context_id on the next call). Inspect the activity log to see the complete shape.Step 3: Creating the Webhook Automation
Now, let’s create the webhook automation that will receive data and trigger the summary generation:Create Another Automation
Configure the Webhook Automation
- Name: “Webhook”
- Slug: “webhook”
- Trigger: Enable “Endpoint” to make it accessible via URL
Set Up the Automation Logic
Save the Webhook Automation
Get Your Webhook URL
- Open the “Triggered when” section of your automation
- Click “Get the link”
- Copy the displayed URL, which will look like:
https://api.studio.prisme.ai/v2/workspaces/YOUR-WorkspaceID/webhooks/webhook
Step 4: Configuring Custom Code
Now, let’s set up the Custom Code app to process our incoming data:Access Custom Code App
Create the CleanData Function
Save the Custom Code Configuration
Step 5: Testing Your Webhook Integration
Let’s test our webhook and see the AI summary generation in action:Prepare a Test Request
https://api.studio.prisme.ai/v2/workspaces/YOUR-WorkspaceID/webhooks/webhook?city=Toulouse&country=FranceSend the Request
Check the Response
Verify Summary Generation
summary-event was triggered and that an Agents.sendMessage call was made to your agent with payload data such as:Agents.sendMessage event in the activity log to see the full agent response captured in agentResponse.
Understanding HTTP Variables in Webhooks
When working with webhooks in Prisme.ai, several HTTP variables are automatically available at the root level inside your endpoint automation:- query: Contains query parameters from the URL
- body: Contains the request body (for POST/PUT requests)
- headers: Contains the HTTP request headers
- method: Contains the HTTP method used (GET, POST, etc.)
query variable to our Custom Code function and including both headers and body in the payload that triggers the summary-event.Version Control and Deployment
To manage your webhook integrations effectively:Save Your Current State
Create Additional Versions
Deploy Specific Versions
Monitoring and Logs
Keep track of your webhook activity and performance:Access Activity Logs
Set Up Alerts
Analyze Performance
Extending Your Webhook Integration
Your base webhook system is powerful, but consider these enhancements:- Authentication: Add API key validation or OAuth to secure your webhooks
- Enhanced Processing: Implement more complex data transformations in your Custom Code
- Multiple Endpoints: Create different webhook endpoints for various data sources or purposes
- Error Handling: Add comprehensive error handling and retry mechanisms
- Integration: Connect your webhooks to other systems like databases, messaging platforms, or CRMs