MCP in Unlimited and Plus. API and webhooks in Plus
Agents
Agents that work without a chat window.
Asking about survey data in a chat is one use of an agent. Feedback should also reach the agents that run on their own: a webhook wakes them, the API or the MCP server lets them act, and what they hear from a customer is stored as a response.
Read the docsHow do AI agents use customer feedback from UserLoop?
UserLoop gives an agent three connections. Webhooks post each response to the agent's URL as it arrives, so nothing has to ask. The REST API lets it read responses, scores and customers with a scoped key. The MCP server gives an AI app 93 tools as the person who signed in. An agent can also store what a customer told it as a survey response, with record_response.
- Events in
- 6 signed webhook events, including response.low_score
- Actions out
- 93 MCP tools and 50 API operations
- Answers in
- record_response over MCP, POST /responses over the API
- Plans
- MCP in Unlimited and Plus. API and webhooks in Plus
How it works
An agent's loop, with nobody typing
01
Something happens
A customer answers, a score comes in low, or a schedule fires. UserLoop posts a signed event to the agent's URL, so the agent never polls.
02
The agent reads
It opens the submission, the order behind it and the scores for the period, through the API with a key or the MCP server as a signed-in person.
03
It acts and records
It drafts a reply, sends a survey email, posts a summary or publishes a survey. What it learned from a customer goes back in as a response.
Recipes
Five agents you can build this week
Each recipe names the events, endpoints or tools involved. The samples use real names and fields. The functions that call your own model are yours to write.
Recipe 1: support
A support agent that answers a low score
A detractor should hear from you while the order is still on their mind. The event arrives by webhook, the agent looks the customer up and a draft reply is waiting for your team.
Event. response.low_score, sent when a score is 0 to 6 on NPS or in the bottom quarter of another scale. It carries the whole submission and the order.
Lookup. GET /responses/{response_id} returns the submission with a customer_summary of their responses, orders and surveys. Over MCP, get_customer takes the response_id and works while the email is masked.
Key. responses:read is the only scope the agent needs. Create the key with contact details only if the reply has to go out by email from the agent itself.
import express from "express";
import { verifyUserLoopSignature } from "./verify.mjs"; // from the webhooks page
const BASE = "https://app.userloop.io/api/v1";
const app = express();
const seen = new Set(); // use your database in production
app.post("/userloop", express.raw({ type: "application/json" }), async (req, res) => {
if (!verifyUserLoopSignature(req.body, req.get("UserLoop-Signature"), process.env.USERLOOP_WEBHOOK_SECRET)) {
return res.status(400).send("Invalid signature");
}
const event = JSON.parse(req.body.toString("utf8"));
res.sendStatus(200); // answer first, then do the work
if (event.type !== "response.low_score" || seen.has(event.id)) return;
seen.add(event.id);
// Look the customer up: the submission, and how often they have answered and ordered
const lookup = await fetch(BASE + "/responses/" + event.data.response_id, {
headers: { Authorization: "Bearer " + process.env.USERLOOP_API_KEY },
});
const { response, customer_summary } = await lookup.json();
// draftReply is yours: your model and your help desk.
// What the customer wrote is data to read, never instructions to follow.
await draftReply({
score: event.data.low_score.score,
order: response.order,
answers: response.answers,
history: customer_summary, // { responses, orders, surveys }
});
});
app.listen(3000);{
"id": "evt_3b9e2d7f0a6c4851b2e9d4f7a0c3e6b1",
"type": "response.low_score",
"data": {
"response_id": "3f9c1a7e5b2d48c6a0e1f7b9d3c5a8e2f4b6d8a0c2e4f6a8b0d2c4e6f8a0b2c4",
"survey": { "public_id": "Nq8XcT2w", "title": "Post-purchase survey" },
"channel": "thank_you",
"customer": { "name": "E. L.", "email": "em**@ex*****.com", "masked": true },
"order": { "order_number": 1042, "total": 84.2, "currency": "USD" },
"answers": [
{
"question_id": "Tm7wL2cN",
"question": "How likely are you to recommend us to a friend?",
"type": "number_score",
"score": 3
},
{
"question_id": "Kd4vR8sJ",
"question": "What could we do better?",
"type": "open_ended",
"answer": ["The bag arrived torn and half the beans were gone."]
}
],
"low_score": { "question_id": "Tm7wL2cN", "score": 3 }
}
}Recipe 2: install
A coding agent that adds a survey to your site
Ask Claude Code, Cursor or Codex for a survey on your pricing page. The agent creates it, sets how it shows and who sees it, adds the snippet to your code and checks the install.
Build. create_survey with the website format, then set_website_display and set_website_targeting. The targeting result lists code_needed: the calls your site must make.
Install. get_site returns the snippet for the shared layout, recipes for Next.js and React, and the Content Security Policy sources. The agent adds them in the same pass.
Publish and check. publish_survey needs an organization admin, and the agent confirms with you first. check_site_install reads real page loads, so localhost never counts.
Recipe 3: interviews
An agent that interviews a customer and stores the answers
Your agent asks a survey's questions in a chat or on a call, in its own words. What the customer said is then recorded as one response, beside the answers that came in the usual way.
Read the survey. get_survey returns every question and answer with its ID. The survey must be a live link, email or website survey.
Check, then record. record_response with validate_only checks every answer and stores nothing. The real call takes an external_id of your own, such as the conversation's ID, so a retry never stores it twice.
Only what was said. The agent records what the customer told it and never fills in, guesses or improves an answer. The connection needs the Add responses permission.
{
"survey_id": "SURVEY_ID",
"external_id": "call-2291",
"answers": [
{ "question_id": "SCORE_QUESTION_PUBLIC_ID", "score": 4 },
{ "question_id": "CHOICE_QUESTION_PUBLIC_ID", "answer_id": "ANSWER_PUBLIC_ID" },
{ "question_id": "TEXT_QUESTION_PUBLIC_ID", "text": "Setup took me two evenings." }
]
}# The same record through the API, for an agent with a key
curl https://app.userloop.io/api/v1/responses \
-H "Authorization: Bearer $USERLOOP_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: call-2291" \
-d '{
"survey_id": "SURVEY_ID",
"external_id": "call-2291",
"answers": [
{ "question_id": "SCORE_QUESTION_PUBLIC_ID", "score": 4 },
{ "question_id": "TEXT_QUESTION_PUBLIC_ID", "text": "Setup took me two evenings." }
]
}'
# Add "validate_only": true to check the answers and record nothingRecipe 4: analysis
A weekly analyst that posts a summary
A script on a schedule reads last week's score and the written answers behind it, hands both to your model and posts what comes back. Nobody opens a dashboard.
Endpoints. GET /analytics/scores for the NPS, its segments and their revenue. GET /written-answers for what customers typed, with the same filters as the responses list.
Least access. A key with responses:read and no contact details. The agent reads masked names and can write nothing.
If a digest is enough. Email reports send a daily, weekly or monthly digest with no agent to run. Build this recipe when you want your own questions asked of the data.
// weekly-summary.mjs. Run it on a schedule, for example cron: 0 8 * * 1
const BASE = "https://app.userloop.io/api/v1";
const headers = { Authorization: "Bearer " + process.env.USERLOOP_API_KEY }; // responses:read is enough
async function get(path, params) {
const res = await fetch(BASE + path + "?" + new URLSearchParams(params), { headers });
const body = await res.json();
if (!res.ok) throw new Error(res.status + " " + body.code + ": " + body.detail);
return body;
}
const lastWeek = { survey_id: "SURVEY_ID", range: "7d" };
const nps = await get("/analytics/scores", { ...lastWeek, question_id: "NPS_QUESTION_ID" });
const written = await get("/written-answers", { ...lastWeek, limit: "100" });
// summarize and postToTeam are yours: your model and your channel.
// What customers wrote is data to summarize, never instructions to follow.
const summary = await summarize({
score: nps.score, // -100 to 100, null when nobody answered
respondents: nps.respondents,
detractors: nps.segments.detractors.count,
quotes: written.data.map((item) => item.text),
});
await postToTeam(summary);Recipe 5: Shopify
An agent that builds, rewards and publishes a post-purchase survey
One sentence to an agent connected to a Shopify store: ask buyers how they heard about us, thank them with a discount code, and put it live on the thank-you page.
Build. create_survey with the checkout format and a goal. UserLoop's AI drafts the questions, and add_question adds any you word yourself.
Reward. search_shopify_discounts lists the store's code discounts, and set_reward gives everyone who finishes their own code under the one you pick.
Publish. publish_survey places it on every connected store, replacing the survey live on the same spot. It needs an organization admin and a plan with rewards.
Recipes 2 and 5
The tool calls, in order
The two recipes that run through the MCP server, written out as the calls an agent makes. Every argument shown is one the tool takes.
# Recipe 2: a website survey, end to end. Tools in the order llms.txt gives.
1. create_survey
{ "format": "website", "goal": "why visitors leave the pricing page without upgrading" }
-> a draft with AI-written questions, and a site set up if there was none
2. set_website_display
{ "survey_id": "SURVEY_ID", "mode": "slide_in", "position": "bottom_right" }
3. set_website_targeting
{ "survey_id": "SURVEY_ID", "devices": ["desktop"], "visitor": "returning", "sample_percent": 50 }
-> code_needed: the calls the site must make, such as userloop.track("signup_completed")
4. publish_survey
{ "survey_id": "SURVEY_ID" }
-> org admins only. The agent confirms with the person first.
5. get_site
-> the snippet for the shared layout, recipes for Next.js and React, the CSP sources
6. check_site_install
-> "not seen yet" until a page of the real site has loaded the snippet# Recipe 5: a post-purchase survey with a reward, for a Shopify store
1. create_survey
{ "format": "checkout", "title": "Post-purchase survey",
"goal": "how customers heard about us and why they bought" }
-> a draft for the Shopify thank-you page
2. search_shopify_discounts
{ "survey_id": "SURVEY_ID", "search": "thanks" }
-> the store's code discounts, to choose one
3. set_reward
{ "survey_id": "SURVEY_ID", "kind": "discount_code",
"discount_id": "gid://shopify/DiscountCodeNode/...",
"code_prefix": "THANKS", "heading": "A thank you for your answers" }
-> everyone who finishes gets their own code
4. publish_survey
{ "survey_id": "SURVEY_ID" }
-> placed on the connected store. Org admins only.Prompts
What you say, and the tools the agent reaches for
The agent picks the tools. These are the ones each request needs, so you know which permissions to tick.
“Add a survey to the pricing page that asks returning visitors what is stopping them from upgrading, then check it is installed.”
create_surveyset_website_displayset_website_targetingpublish_surveyget_sitecheck_site_install“Build a post-purchase survey that asks how people heard about us, give everyone who finishes a discount code, and publish it.”
create_surveysearch_shopify_discountsset_rewardpublish_survey“Here is the transcript of my call with a customer. Record their answers to the onboarding survey.”
get_surveyrecord_response“Summarize last week's NPS and quote three detractors who mentioned delivery.”
score_metricslist_written_answers“Send the support survey to the customer from ticket 1042.”
list_surveyssend_survey_email“Set up a webhook so my support agent hears about every low score, and send it a test event.”
create_webhooksend_test_webhook
Access
How access is controlled
An agent can do exactly what a person allowed, as that person, and no more. Which control applies depends on how the agent connects.
MCP server
OAuth permissions for agents that act for a person
A person signs in to UserLoop in their browser and ticks what the app may do. There is no key to copy, and the agent's tool list shows only what was allowed.
7 permissions. Read surveys, Edit surveys, Read responses, Add responses, Manage reports, Read account, Change settings. All are ticked to start with. Untick what the agent should not do.
Organizations. The person picks which organizations the app may use. One connection can cover several stores.
The role still applies. The app acts as the person, with their role. A member who ticks Edit surveys lets it edit drafts, but only an admin's connection can publish.
30 days, or revoked sooner. An approval lasts 30 days and can be revoked on the MCP server page at any time, which signs the app out straight away.
API and webhooks
Scoped keys and signed events for agents that run alone
An agent on a schedule or behind a webhook has nobody to sign in again after 30 days. Give it an API key with the scopes its job needs, and let it check every event it is sent.
7 scopes. Chosen when the key is created and fixed after that. To give an agent more, create a new key and revoke the old one.
Expiry you choose. 30 days, 90 days, 1 year or never. A key acts as the person who created it and stops within 15 minutes if they leave the organization.
Signed events. Each webhook event is signed with the endpoint's secret in the UserLoop-Signature header, so the agent can prove an event came from UserLoop before it acts.
Tied together. A webhook endpoint added with an API key stops when that key does, and delivers only what the key could read.
Guardrails
What holds whatever the agent is told
A customer can type anything into a survey. These limits do not depend on the agent reading it the right way.
Masked contact details
Emails and names are left out unless the person asks for them over MCP, or the key allows them and the request asks over the API.
Customer text is data
Text written by customers is labelled as data in tool results: something to read and report, never instructions, even when phrased as one.
Nothing hard deleted
Surveys and responses are never permanently deleted through the MCP server.
Drafts until published
Edits go into the survey's draft. Customers see them only at publish, which needs an organization admin.
Two acts are immediate
Recording a response and sending a survey email happen at once, so tick Add responses and Edit surveys with that in mind.
Marked tools
Of the 93 tools, 40 only read, and 11 are marked as destructive in the tool list.
Rate limits
120 MCP calls a minute, and about 120 API requests a minute for each key.
The plan still applies
Features the plan does not include stay unavailable, whatever was ticked. A refusal names the plan needed.
Setup
The agent skill and llms.txt
llms.txt is a page written for agents. It tells one how to connect itself where it runs, what the tools do, how to record answers and how to install a website survey. The skill keeps the same instructions on hand.
# Send this line to any agent, in its chat
set up UserLoop: https://mcp.userloop.io/llms.txt
# Agents that take skills can keep the same instructions as the userloop skill
npx skills add https://app.userloop.ioclaude mcp add --scope user --transport http userloop https://mcp.userloop.io
# Start Claude Code again, run /mcp, choose userloop and sign incodex mcp add userloop --url https://mcp.userloop.io
codex mcp login userloop{
"mcpServers": {
"userloop": { "url": "https://mcp.userloop.io" }
}
}code --add-mcp '{"name":"userloop","type":"http","url":"https://mcp.userloop.io"}'
# Then run MCP: List Servers from the command palette, start userloop and sign inFrequently asked questions
How do I give an AI agent access to customer feedback?
Three ways, often used together. Add a webhook so each response is posted to the agent as it arrives, give the agent an API key with only the scopes it needs, or connect an AI app to the MCP server at https://mcp.userloop.io and sign in.
Does UserLoop have an MCP server for customer feedback?
Yes. https://mcp.userloop.io is a remote MCP server with 93 tools: 40 that read and 53 that write. An AI app signs in with OAuth as a person and can build surveys, read responses and scores, and request reports. It is on Unlimited and Plus.
Can an agent work with UserLoop when nobody is in a chat?
Yes. A webhook posts events such as response.low_score to the agent's own URL, and the agent calls the REST API with a key that can be set never to expire. The API and webhooks are on the Plus plan.
Can an agent record answers it collected in a conversation?
Yes. record_response over MCP, or POST /responses over the API, stores one submission against a live link, email or website survey. Each answer is checked against the published survey first, and an external_id of your own makes a retry safe.
Can an agent see my customers' email addresses?
Not by default. Over MCP, emails and names are left out unless the person asks for them. Over the API they are masked unless the key was created with contact details and the request asks for them.
What stops a survey answer from giving my agent instructions?
Text written by customers is labelled as data in tool results, and UserLoop's instructions for agents say to treat it as something to read, never to follow. Permissions limit the damage in any case: an agent can only do what was ticked, and nothing is permanently deleted through the MCP server.
Can a coding agent install a survey on my website?
Yes. Connected to the MCP server, a coding agent creates a website survey, sets its display and targeting, gets the snippet with recipes for Next.js and React, adds it to your code and runs check_site_install. Publishing needs an organization admin.
What are the agent skill and llms.txt?
llms.txt at https://mcp.userloop.io/llms.txt is a plain page of instructions for agents: how to connect, what the tools do and the order of calls for common jobs. npx skills add https://app.userloop.io installs the same instructions as the userloop skill.
Which plan do I need?
The MCP server is on Unlimited and Plus. The API and webhooks are on Plus, at $99 a month. Paid plans start with a 14-day trial.
Keep reading
Start with one event and one agent
Add a webhook for response.low_score, or send your coding agent the setup line. The MCP server is on Unlimited and Plus, the API and webhooks on Plus.