openapi: 3.1.0
info:
title: agent-states-api-v2 AccountSet Messages API
version: '1.1'
servers:
- url: https://{instance}.response.lithium.com/api/v2/agentstate
variables:
instance:
default: instance
security:
- {}
tags:
- name: Messages
paths:
/{integrationUuid}/messages/validation:
post:
summary: Validate JSON request of inbound messages
description: Validate the JSON request of inbound messages
operationId: integrationuuidmessagesvalidation
parameters:
- name: integrationUuid
in: path
description: The unique identifier of the social integration
schema:
type: string
required: true
requestBody:
content:
application/json:
schema:
type: object
properties:
RAW_BODY:
type: string
description: The Raw JSON payload. Refer to [Listening API object definitions](ref:listening-api-object-definitions) to build your JSON.
format: json
responses:
'200':
description: '200'
content:
application/json:
examples:
Result:
value: "{\n \"status\":\"success\",\n \"data\":[\n \"z135g3jz2tm0x5uq23gerbpiybcbb4\"\n ]\n}"
schema:
type: object
properties:
status:
type: string
example: success
data:
type: array
items:
type: string
example: z135g3jz2tm0x5uq23gerbpiybcbb4
'400':
description: '400'
content:
application/json:
examples:
Result:
value: '{}'
schema:
type: object
properties: {}
deprecated: false
security: []
x-readme:
code-samples:
- language: http
code: https://your_care_instance.lithium.com/api/v2/listening/fa600d27-dde1-4bdc-a3be-2f3edff236c7/messages/validation
name: /integrationUuid/messages/validation Example
samples-languages:
- http
tags:
- Messages
/{integrationUuid}/messages:
post:
summary: Create inbound messages
description: Create inbound messages
operationId: integrationuuiddiscussion
parameters:
- name: integrationUuid
in: path
description: The unique identifier of the social integration
schema:
type: string
required: true
requestBody:
content:
application/json:
schema:
type: object
properties:
RAW_BODY:
type: string
description: The Raw JSON payload. Refer to [Listening API object definitions](ref:listening-api-object-definitions) to build your JSON.
format: json
responses:
'200':
description: '200'
content:
application/json:
examples:
Result:
value: "{\n \"status\":\"success\",\n \"data\":[\n \"z135g3jz2tm0x5uq23gerbpiybcbb4\"\n ]\n}"
schema:
type: object
properties:
status:
type: string
example: success
data:
type: array
items:
type: string
example: z135g3jz2tm0x5uq23gerbpiybcbb4
'400':
description: '400'
content:
application/json:
examples:
Result:
value: '{}'
schema:
type: object
properties: {}
deprecated: false
security: []
x-readme:
code-samples:
- language: http
code: https://servername.response.lithium.com/api/v2/listening/fa600d27-dde1-4bdc-a3be-2f3edff236c7/messages
name: /integrationUuid/messages Example
samples-languages:
- http
tags:
- Messages
delete:
summary: Delete messages
description: Delete messages
operationId: integrationuuidmessages-1
parameters:
- name: integrationUuid
in: path
description: The unique identifier of the social integration
schema:
type: string
required: true
requestBody:
content:
application/json:
schema:
type: object
properties:
RAW_BODY:
type: string
description: The Raw JSON payload. Refer to [Listening API object definitions](ref:listening-api-object-definitions) to build your JSON.
format: json
responses:
'200':
description: '200'
content:
application/json:
examples:
Result:
value: "{\n \"status\":\"success\",\n \"data\":[\n \"z135g3jz2tm0xf5uq23gerbpiybcbb4\"\n ]\n}"
schema:
type: object
properties:
status:
type: string
example: success
data:
type: array
items:
type: string
example: z135g3jz2tm0xf5uq23gerbpiybcbb4
'400':
description: '400'
content:
application/json:
examples:
Result:
value: '{}'
schema:
type: object
properties: {}
deprecated: false
security: []
x-readme:
code-samples:
- language: http
code: https://servername.response.lithium.com/api/v2/listening/fa600d27-dde1-4bdc-a3be-2f3edff236c7/messages
name: DELETE /integrationUuid/messages Example
samples-languages:
- http
tags:
- Messages
/messages:
post:
summary: Generate a Thread ID
description: Generate a thread ID for various REST API usages.
operationId: generate-a-thread-id
responses:
'200':
description: '200'
content:
application/json:
examples:
Result:
value: "{\n \"status\": \"ok\",\n \"threadId\": \"1f85dbe7-fc0a-4f43-a1a0-87216587ab7b|w_caRv6my_8\"\n}"
schema:
type: object
properties:
status:
type: string
example: ok
threadId:
type: string
example: 1f85dbe7-fc0a-4f43-a1a0-87216587ab7b|w_caRv6my_8
deprecated: false
x-readme:
code-samples:
- language: http
code: 'POST rest/v1/messages HTTP/1.1
HOST: api.flow.ai
Content-Type: application/json
Authorization: MY_MESSAGING_API_KEY'
- language: javascript
code: "import request from \"async-request\";\nconst result = await request({\n method: 'POST',\n url: 'https://api.flow.ai/rest/v1/messages',\n headers: {\n 'Authorization': 'MY_MESSAGING_API_KEY',\n 'Content-Type': 'application/json'\n },\n json: true\n})"
samples-languages:
- http
- javascript
tags:
- Messages
/messages/{threadId}:
post:
summary: Create a Text Message
description: Send a text message with the Flow REST API.
operationId: create-a-text-message
parameters:
- name: '{threadId}'
in: path
description: Unique identifier of the thread
schema:
type: string
required: true
- name: sync
in: query
description: Indicates that this message should be processed in sync mode.
schema:
type: boolean
default: true
- name: writeConcern
in: query
description: Indicates that this message should be processed in writeConcern mode.
schema:
type: boolean
default: true
requestBody:
content:
application/json:
schema:
type: object
properties:
payload:
type: array
items:
properties:
traceId:
type: integer
description: Optional unique number that is passed along to identify the message. Use this to verify message delivery.
format: int32
type:
type: string
description: Indicates the type of message. Should be `text`
speech:
type: string
description: The text or speech message to process. The maximum length of a message is 255 characters.
originator:
type: object
description: Indicates the information about the sender.
properties:
name:
type: string
description: Name representing the originator
role:
type: string
description: Either `external` or `moderator`
profile:
type: object
description: Optional Profile object. An originator can contain additional profile information using the profile object.
properties:
fullName:
type: string
description: Complete name
firstName:
type: string
description: First name
lastName:
type: string
description: Family name
gender:
type: string
description: Gender - M, F or U
language:
type: string
description: Two letter [language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) for example `fr`
country:
type: string
description: Lowercase, two letter [country code](https://en.wikipedia.org/wiki/ISO_639-1)
locale:
type: string
description: Locale code that combines the language and country code for example `en-GB`
timezone:
type: integer
description: Number of hours of UTC
format: int32
email:
type: string
description: Email address
phoneNumber:
type: string
description: Phone number in [E.164 format](https://en.wikipedia.org/wiki/E.164)
picture:
type: string
description: URL to profile picture
metadata:
type: object
description: The metadata is dynamic in nature and contains key value pairs with additional info. This is optional.
properties: {}
type: object
responses:
'200':
description: '200'
content:
application/json:
examples:
Result:
value: "{\n \"status\": \"ok\",\n \"activityId\": \"EXAMPLE-46b1-42b5-aefb-81856a7680bd\",\n \"agentId\": \"a_EbAZzSW\",\n \"channelId\": \"a_EbAZzSW\",\n \"channelName\": \"gateway\",\n \"threadId\": \"EXAMPLE-79b4-4543-9373-053924209cc7\",\n \"messages\": [\n {\n \"fallback\": \"Hello\",\n \"silent\": false,\n \"replyTo\": \"hi\",\n \"originator\": {\n \"userId\": \"flowai|system\",\n \"name\": \"system\",\n \"role\": \"bot\",\n \"profile\": {\n \"picture\": \"https://flow.ai/img/EXAMPLES/flowai.svg\"\n }\n },\n \"actions\": [],\n \"responses\": [\n {\n \"type\": \"text\",\n \"payload\": {\n \"text\": \"Hello\"\n }\n }\n ],\n \"intents\": [],\n \"entities\": [],\n \"flow\": {\n \"flowId\": \"fF5gEqEko\",\n \"title\": \"Untitled\",\n \"group\": \"Default\",\n \"metadata\": []\n },\n \"step\": {\n \"stepId\": \"sXaM8etEl\",\n \"title\": \"Hi\",\n \"type\": \"INTENT\"\n },\n \"slot\": false,\n \"params\": {},\n \"contexts\": [],\n \"meta\": {\n \"msgId\": \"EXAMPLE-6b60-47fd-950c-16634d3f2eef\",\n \"prevMsgId\": null,\n \"childMsgId\": \"EXAMPLE-29b7-4768-832d-56a6d1eaa8c6\",\n \"prevChildMsgId\": null,\n \"createdAt\": 1632166271745,\n \"keepTyping\": false\n }\n }\n ],\n \"sentiment\": 0,\n \"accuracy\": 0,\n \"originator\": {\n \"userId\": \"flowai|system\",\n \"name\": \"system\",\n \"role\": \"bot\",\n \"profile\": {\n \"picture\": \"https://flow.ai/img/EXAMPLE/flowai.svg\"\n }\n },\n \"traceId\": \"EXAMPLE487a59c:23cab391bd64d5f1:6beafa70c487a59c:1\",\n \"createdAt\": \"2021-09-20T19:31:12.031Z\",\n \"replyTo\": \"hi\",\n \"user\": {\n \"name\": \"M B\",\n \"role\": \"external\",\n \"profile\": {\n \"fullName\": \"M B\",\n \"firstName\": \"M\",\n \"lastName\": \"B\",\n \"email\": \"EXAMPLE@mail.com\",\n \"locale\": \"en\",\n \"timezone\": 3,\n \"gender\": \"U\"\n }\n },\n \"metadata\": {\n \"params\": {}\n },\n \"connectionKey\": \"EXAMPLE-cebd-428c-b3e8-8689bd42d842\"\n}"
schema:
type: object
properties:
status:
type: string
example: ok
activityId:
type: string
example: EXAMPLE-46b1-42b5-aefb-81856a7680bd
agentId:
type: string
example: a_EbAZzSW
channelId:
type: string
example: a_EbAZzSW
channelName:
type: string
example: gateway
threadId:
type: string
example: EXAMPLE-79b4-4543-9373-053924209cc7
messages:
type: array
items:
type: object
properties:
fallback:
type: string
example: Hello
silent:
type: boolean
example: false
default: true
replyTo:
type: string
example: hi
originator:
type: object
properties:
userId:
type: string
example: flowai|system
name:
type: string
example: system
role:
type: string
example: bot
profile:
type: object
properties:
picture:
type: string
example: https://flow.ai/img/EXAMPLES/flowai.svg
actions:
type: array
items:
type: object
properties: {}
responses:
type: array
items:
type: object
properties:
type:
type: string
example: text
payload:
type: object
properties:
text:
type: string
example: Hello
intents:
type: array
items:
type: object
properties: {}
entities:
type: array
items:
type: object
properties: {}
flow:
type: object
properties:
flowId:
type: string
example: fF5gEqEko
title:
type: string
example: Untitled
group:
type: string
example: Default
metadata:
type: array
items:
type: object
properties: {}
step:
type: object
properties:
stepId:
type: string
example: sXaM8etEl
title:
type: string
example: Hi
type:
type: string
example: INTENT
slot:
type: boolean
example: false
default: true
params:
type: object
properties: {}
contexts:
type: array
items:
type: object
properties: {}
meta:
type: object
properties:
msgId:
type: string
example: EXAMPLE-6b60-47fd-950c-16634d3f2eef
prevMsgId: {}
childMsgId:
type: string
example: EXAMPLE-29b7-4768-832d-56a6d1eaa8c6
prevChildMsgId: {}
createdAt:
type: integer
example: 1632166271745
default: 0
keepTyping:
type: boolean
example: false
default: true
sentiment:
type: integer
example: 0
default: 0
accuracy:
type: integer
example: 0
default: 0
originator:
type: object
properties:
userId:
type: string
example: flowai|system
name:
type: string
example: system
role:
type: string
example: bot
profile:
type: object
properties:
picture:
type: string
example: https://flow.ai/img/EXAMPLE/flowai.svg
traceId:
type: string
example: EXAMPLE487a59c:23cab391bd64d5f1:6beafa70c487a59c:1
createdAt:
type: string
example: '2021-09-20T19:31:12.031Z'
replyTo:
type: string
example: hi
user:
type: object
properties:
name:
type: string
example: M B
role:
type: string
example: external
profile:
type: object
properties:
fullName:
type: string
example: M B
firstName:
type: string
example: M
lastName:
type: string
example: B
email:
type: string
example: EXAMPLE@mail.com
locale:
type: string
example: en
timezone:
type: integer
example: 3
default: 0
gender:
type: string
example: U
metadata:
type: object
properties:
params:
type: object
properties: {}
connectionKey:
type: string
example: EXAMPLE-cebd-428c-b3e8-8689bd42d842
deprecated: false
security: []
x-readme:
code-samples:
- language: http
code: "POST rest/v1/messages/EXAMPLE-853a-448f-9f91-ef397588ff87 HTTP/1.1\nHost: api.flow.ai\nContent-Type: application/json\nAuthorization: MY_MESSAGING_API_KEY\n{\n \"payload\": {\n \"type\": \"text\",\n \"speech\": \"hello\",\n \"originator\": {\n \"name\": \"John Doe\",\n \"role\": \"external\",\n \"profile\": {\n \"fullName\": \"John Doe\",\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"gender\": \"M\",\n \"locale\": \"en-US\",\n \"timezone\": -5,\n \"country\": \"us\",\n \"email\": \"EXAMPLE@dmail.com\",\n \"picture\": \"https://...\"\n } \n },\n \"metadata\": {\n \"language\": \"en\",\n \"timezone\": 5,\n \"params\": {\n \"product\": [{\n \"value\": \"Dish washer\"\n }],\n \"problems\": [{\n \"value\": \"Noise\"\n }, {\n \"value\": \"Leaks\"\n }]\n }\n }\n }\n}"
samples-languages:
- http
tags:
- Messages
get:
summary: Retrieve a list of messages
description: Fetches a list of messages using the Flow REST API.
operationId: get-a-list-of-messages
parameters:
- name: sync
in: query
description: Optional parameter for enabling sync mode.
schema:
type: string
- name: page
in: query
description: Optional parameter for pagination
schema:
type: integer
format: int32
- name: '{threadId}'
in: path
description: A unique identifier of the thread. This is a required field.
schema:
type: string
required: true
- name: event
in: query
description: Optional parameter to enable to retrieve the history of triggered events. Default value is `false`
schema:
type: boolean
responses:
'200':
description: '200'
content:
application/json:
examples:
Result:
value: "{\n \"status\": \"ok\",\n \"result\": {\n \"history\": [\n\n {\n \"originator\": {\n \"name\": \"Anonymous\",\n \"role\": \"external\",\n \"profile\": {\n \"fullName\": \"Anonymous\"\n }\n },\n \"messages\": [\n {\n \"fallback\": \"Test Event\",\n \"replyTo\": null,\n \"contexts\": [],\n \"params\": {},\n \"intents\": [],\n \"createdAt\": \"2021-09-14T13:45:08.516Z\",\n \"meta\": {\n \"msgId\": \"EXAMPLE-da4b-45aa-bf7a-2556a6ad073d\"\n },\n \"responses\": [\n {\n \"type\": \"event\",\n \"payload\": {\n \"lat\": null,\n \"long\": null,\n \"name\": \"Selection\",\n \"title\": null,\n \"url\": null\n }\n }\n ]\n }\n ],\n \"interactionId\": \"EXAMPLE-bc7e-4ddf-a3bf-ea9c069602fb\"\n }\n \n ],\n \"threadId\": \"EXAMPLE-853a-448f-9f91-ef397588ff87\",\n \"page\": 3,\n \"pages\": 5\n }\n}"
schema:
type: object
properties:
status:
type: string
example: ok
result:
type: object
properties:
history:
type: array
items:
type: object
properties:
originator:
type: object
properties:
name:
type: string
example: Anonymous
role:
type: string
example: external
profile:
type: object
properties:
fullName:
type: string
example: Anonymous
messages:
type: array
items:
type: object
properties:
fallback:
type: string
example: Test Event
replyTo: {}
contexts:
type: array
items:
type: object
properties: {}
params:
type: object
properties: {}
intents:
type: array
items:
type: object
properties: {}
createdAt:
type: string
example: '2021-09-14T13:45:08.516Z'
meta:
type: object
properties:
msgId:
type: string
example: EXAMPLE-da4b-45aa-bf7a-2556a6ad073d
responses:
type: array
items:
type: object
properties:
type:
type: string
example: event
payload:
type: object
properties:
lat: {}
long: {}
name:
type: string
example: Selection
title: {}
url: {}
interactionId:
type: string
example: EXAMPLE-bc7e-4ddf-a3bf-ea9c069602fb
threadId:
type: string
example: EXAMPLE-853a-448f-9f91-ef397588ff87
page:
type: integer
example: 3
default: 0
pages:
type: integer
example: 5
default: 0
deprecated: false
security: []
x-readme:
code-samples:
- language: http
code: 'GET rest/v1/messages/EXAMPLE-853a-448f-9f91-ef397588ff87?sync=true&page=3&events=true HTTP/1.1
Host: api.flow.ai
Content-Type: application/json
Authorization: MY_MESSAGING_API_KEY'
samples-languages:
- http
tags:
- Messages
/{environment}/v1/company/{companyId}/initiative/{initiativeId}/message:
post:
tags:
- Messages
summary: Publish a new message.
description: Publish a new *Spredfast* Messages for the target Initiative.
operationId: publishMessage
parameters:
- name: companyId
in: path
required: true
schema:
type: integer
format: int64
- name: initiativeId
in: path
required: true
schema:
type: integer
format: int64
- name: environment
in: path
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
/{environment}/v1/company/{companyId}/initiative/{initiativeId}/message/{messageId}:
get:
tags:
- Messages
summary: Retrieve an existing message.
description: The Messages endpoint returns information about the *Spredfast* Messages for the target Initiative.
operationId: getMessage
parameters:
- name: messageId
in: path
required: true
schema:
type: integer
format: int64
- name: environment
in: path
required: true
schema:
type: string
- name: companyId
in: path
required: true
schema:
# --- truncated at 32 KB (54 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/lithium/refs/heads/main/openapi/lithium-messages-api-openapi.yml