Goals, questions, and platform goals
Create and manage the feedback configuration for a project.
These operations require the storefront permission. Use them to configure what your project wants to learn and how it prioritizes feedback.
goals.list
List goals request
GET /project/{projectId}/goals
import { goals } from '@orvelt/business';
const result = await goals.list({
projectId: 'PROJECT_ID',
page: 1,
limit: 25,
});
if (result.error) throw new Error(result.error.message);
console.log(result.data);curl --request GET \
--url "$ORVELT_API_BASE_URL/project/PROJECT_ID/goals?page=1&limit=25" \
--header "x-api-key: $ORVELT_BUSINESS_API_KEY"Accepts optional page and limit query parameters.
goals.create
Create goal request
POST /project/{projectId}/goals
import { goals } from '@orvelt/business';
const result = await goals.create({
projectId: 'PROJECT_ID',
goal: 'Learn why first-time customers return.',
});
if (result.error) throw new Error(result.error.message);curl --request POST \
--url "$ORVELT_API_BASE_URL/project/PROJECT_ID/goals" \
--header "x-api-key: $ORVELT_BUSINESS_API_KEY" \
--header "content-type: application/json" \
--data '{"goal":"Learn why first-time customers return."}'goal is required and accepts a string from 1 through 2000 characters.
goals.update
Update goal request
PATCH /project/{projectId}/goals/{goalId}
import { goals } from '@orvelt/business';
const result = await goals.update({
projectId: 'PROJECT_ID',
goalId: 'GOAL_ID',
goal: 'Learn why returning customers recommend us.',
});
if (result.error) throw new Error(result.error.message);curl --request PATCH \
--url "$ORVELT_API_BASE_URL/project/PROJECT_ID/goals/GOAL_ID" \
--header "x-api-key: $ORVELT_BUSINESS_API_KEY" \
--header "content-type: application/json" \
--data '{"goal":"Learn why returning customers recommend us."}'goals.delete
Delete goal request
DELETE /project/{projectId}/goals/{goalId}
import { goals } from '@orvelt/business';
const result = await goals.delete({
projectId: 'PROJECT_ID',
goalId: 'GOAL_ID',
});
if (result.error) throw new Error(result.error.message);curl --request DELETE \
--url "$ORVELT_API_BASE_URL/project/PROJECT_ID/goals/GOAL_ID" \
--header "x-api-key: $ORVELT_BUSINESS_API_KEY"questions.list
List questions request
GET /project/{projectId}/questions
import { questions } from '@orvelt/business';
const result = await questions.list({
projectId: 'PROJECT_ID',
});
if (result.error) throw new Error(result.error.message);
console.log(result.data);curl --request GET \
--url "$ORVELT_API_BASE_URL/project/PROJECT_ID/questions" \
--header "x-api-key: $ORVELT_BUSINESS_API_KEY"questions.create
Create question request
POST /project/{projectId}/questions
import { questions } from '@orvelt/business';
const result = await questions.create({
projectId: 'PROJECT_ID',
tags: ['Experience'],
priority: 50,
question: 'What would make your next visit better?',
answerMode: 'single_select',
answers: {
options: [
{ id: crypto.randomUUID(), option: 'Speed' },
{ id: crypto.randomUUID(), option: 'Price' },
{ id: crypto.randomUUID(), option: 'Service', description: 'Staff and support' },
],
},
status: 'active',
responseVisibility: 'default',
});
if (result.error) throw new Error(result.error.message);curl --request POST \
--url "$ORVELT_API_BASE_URL/project/PROJECT_ID/questions" \
--header "x-api-key: $ORVELT_BUSINESS_API_KEY" \
--header "content-type: application/json" \
--data '{"tags":["Experience"],"priority":50,"question":"What would make your next visit better?","answerMode":"single_select","answers":{"options":[{"id":"speed","option":"Speed"},{"id":"price","option":"Price"},{"id":"service","option":"Service","description":"Staff and support"}]},"status":"active","responseVisibility":"default"}'tags needs at least one supported goal tag. answers holds everything about how the question is answered. For select modes, answers.options needs two through six objects, each with a unique id (up to 64 characters), unique option text, and an optional description. Omit answers.options for text_only; answers defaults to {}. Answers still report the chosen option text in selectedOptions, not the option id.
questions.update
Update question request
PATCH /project/{projectId}/questions/{questionId}
import { questions } from '@orvelt/business';
const result = await questions.update({
projectId: 'PROJECT_ID',
questionId: 'QUESTION_ID',
status: 'archived',
});
if (result.error) throw new Error(result.error.message);curl --request PATCH \
--url "$ORVELT_API_BASE_URL/project/PROJECT_ID/questions/QUESTION_ID" \
--header "x-api-key: $ORVELT_BUSINESS_API_KEY" \
--header "content-type: application/json" \
--data '{"status":"archived"}'All update body fields are optional. Send only the fields you intend to change.
questions.delete
Delete question request
DELETE /project/{projectId}/questions/{questionId}
import { questions } from '@orvelt/business';
const result = await questions.delete({
projectId: 'PROJECT_ID',
questionId: 'QUESTION_ID',
});
if (result.error) throw new Error(result.error.message);curl --request DELETE \
--url "$ORVELT_API_BASE_URL/project/PROJECT_ID/questions/QUESTION_ID" \
--header "x-api-key: $ORVELT_BUSINESS_API_KEY"platformGoals.get
Get priorities request
GET /project/{projectId}/platform-goals
import { platformGoals } from '@orvelt/business';
const result = await platformGoals.get({
projectId: 'PROJECT_ID',
});
if (result.error) throw new Error(result.error.message);
console.log(result.data);curl --request GET \
--url "$ORVELT_API_BASE_URL/project/PROJECT_ID/platform-goals" \
--header "x-api-key: $ORVELT_BUSINESS_API_KEY"platformGoals.update
Update priorities request
PATCH /project/{projectId}/platform-goals
import { platformGoals } from '@orvelt/business';
const result = await platformGoals.update({
projectId: 'PROJECT_ID',
platformGoals: [
{ id: 'experience', position: 0 },
{ id: 'reliability', position: 1 },
{ id: 'trust', position: 2 },
],
});
if (result.error) throw new Error(result.error.message);curl --request PATCH \
--url "$ORVELT_API_BASE_URL/project/PROJECT_ID/platform-goals" \
--header "x-api-key: $ORVELT_BUSINESS_API_KEY" \
--header "content-type: application/json" \
--data '{"platformGoals":[{"id":"experience","position":0},{"id":"reliability","position":1},{"id":"trust","position":2}]}'platformGoals accepts one through eight goal entries. Each position is a non-negative integer.