API referenceCustom moments

Define a custom moment

POST
/moments

Defines a moment type in plain English. It starts as a draft at version 1, edited in place until it first goes live; make it live with an update. Its name is the kind its moments carry.

Authorization

apiKey
X-API-Key<token>

API key (prefix spk_test_ or spk_live_) or personal access token (prefix pat_)

In: header

Header Parameters

Idempotency-Key*string

Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request.

Lengthlength <= 255

Request Body

application/json

color?string

The color it is shown in; picked from the name when absent

Value in

  • "violet"
  • "blue"
  • "teal"
  • "green"
  • "yellow"
  • "orange"
  • "red"
  • "pink"
  • "gray"
examples?

Up to 10 lines each it should and should not fire on

label?string

Its display name; the name in words when absent (pricing_objection is Pricing objection)

Lengthlength <= 60
min_confidence?number

The classifier's probability a turn needs to fire it, above 0 and up to 1; 0.5 when absent

Formatdouble
name*string

The kind its moments will carry: snake_case, unique in the organization, and not a built-in kind. Fixed once created.

Lengthlength <= 40
not_when?string

When it does not fire, though it might look like it should

Lengthlength <= 1000
timing?string

act (the default) waits for the exchange to land, answer goes while a question still hangs, ideas lets one fire serve a brainstorm

Value in

  • "act"
  • "answer"
  • "ideas"
when*string

When it fires, in plain English

Lengthlength <= 1000

Response Body

application/json

application/json

curl -X POST "https://example.com/moments" \  -H "Idempotency-Key: string" \  -H "Content-Type: application/json" \  -d '{    "name": "pricing_objection",    "when": "The customer pushes back on price, asks for a discount, or compares us to a cheaper option."  }'
{  "color": "violet",  "created_at": "2019-08-24T14:15:22Z",  "examples": {    "fire": [      "string"    ],    "skip": [      "string"    ]  },  "id": "mdef_2jxsy8cc8v0348asy6t1",  "label": "Pricing objection",  "live_version": 0,  "min_confidence": 0.1,  "name": "pricing_objection",  "not_when": "string",  "shadow_version": 0,  "status": "draft",  "timing": "act",  "updated_at": "2019-08-24T14:15:22Z",  "version": 0,  "when": "string"}