Goals
A goal defines what should happen in a campaign conversation, such as "Asked for a quote". The report counts conversations that meet the criteria.
Before you start: the campaign id in the CAMPAIGN_ID variable.
Create a goal
curl -X POST https://api.platic.ai/v1/campaigns/$CAMPAIGN_ID/goals \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "Asked for a quote", "criteria": "The customer asks for a price." }' const campaignId = process.env.CAMPAIGN_ID!;
const goal = await platic.campaigns.goals.create(campaignId, {
name: "Asked for a quote",
criteria: "The customer asks for a price.",
}); In the Spring sale campaign, count it as achieved when the customer asks for a price or a quote.
Your assistant uses create_campaign_goal.
If a goal with that name already exists, the response is 200 with that goal and alreadyExisted: true. Update that goal to change its criteria.
List reference
| Parameter | In | Type | Description | Required |
|---|---|---|---|---|
campaignId | path | string | The campaign id | ✓ |
workspace | query | string | The campaign's workspace, if the credential covers several | — |
data carries all the campaign's goals, without pagination:
{
"status": "success",
"data": [
{ "id": "gq3Lm8Xp", "name": "Asked for a quote", "criteria": "The customer asks for a price.", "status": "active" }
]
} | Status | details.code | When |
|---|---|---|
400 | INVALID_REQUEST | The credential covers several workspaces and workspace is missing or is not one of them |
See Errors for the full shape of an error.
Create reference
| Field | Type | Description | Required |
|---|---|---|---|
name | string | A short, clear name, up to 120 characters | ✓ |
criteria | string | How you can tell in the conversation that it was achieved, up to 2,000 characters | ✓ |
It answers 201 with the new goal, or 200 with the one that already existed:
{
"status": "success",
"message": "Goal created",
"data": {
"id": "gq3Lm8Xp",
"name": "Asked for a quote",
"criteria": "The customer asks for a price.",
"status": "active",
"alreadyExisted": false
}
} Update reference
Send name, criteria, or both, using the same limits as for creation. Get the goalId by listing goals. The response contains the updated goal.
| Status | details.code | When |
|---|---|---|
400 | — | Neither name nor criteria arrived, or they go over the limit |
404 | GOAL_NOT_FOUND | The campaign has no goal with that id |