Communicate with AutoCompose via API.
/analytics/message-sent
endpointConversation Event | API Request |
---|---|
Conversation starts | 1. Create a new ASAPP conversation record 2. Request first set of response suggestions |
Agent keystroke | 1. Request updated response suggestions |
Agent uses the spacebar | 1. Request updated response suggestions 2. Check the spelling of the most recent word |
Agent searches for a response | 1. Get the response list that pertains to their search |
Agent saves a custom response | 1. Add the new response to their personal library |
Agent submits their message | 1. Check if any profanity is present in the message |
Agent message is sent | 1. Add the message to ASAPP’s conversation record 2. Create analytics event for the message that details how the agent used AutoCompose 3. Request updated response suggestions |
Customer message is sent | 1. Add the message to ASAPP’s conversation record 2. Request updated response suggestions |
asapp-api-id
API Key and the asapp-api-secret
. You can find them under your Apps in the AI Services Developer Portal.
All requests to ASAPP sandbox and production APIs must use HTTPS
protocol. Traffic using HTTP
will not be redirected to HTTPS
.POST /conversation/v1/conversations
POST /conversation/v1/conversations/\{conversationId\}/messages
POST /autocompose/v1/conversations/\{conversationId\}/suggestions
POST /autocompose/v1/profanity/evaluation
POST /autocompose/v1/spellcheck/correction
POST /autocompose/v1/analytics/message-sent
GET /autocompose/v1/responses/globals
GET /autocompose/v1/responses/customs
POST /autocompose/v1/responses/customs/response
PUT /autocompose/v1/responses/customs/response/\{responseId\}
DELETE /autocompose/v1/responses/customs/response/\{responseId\}
POST /autocompose/v1/responses/customs/folder
PUT /autocompose/v1/responses/customs/folder/\{folderId\}
DELETE /autocompose/v1/responses/customs/folder/\{folderId\}
POST /conversation/v1/conversations
Use this endpoint to create a new conversation record or update an existing conversation record.
When to Call
This service should be called when a conversation starts or when something about the conversation changes (e.g. a conversation is reassigned to a different agent).
Request Details
Requests must include a conversation identifier from your system of record (external to ASAPP) and a timestamp (formatted in RFC3339 micro second date-time expressed in UTC) for when the conversation started.
Requests to create a conversation record must also include identifying information about the human participants. Two types of requests are supported to create a new conversation:
agent
and customer
objects in the request when the conversation begins.customer
object in the initial request when the conversation with the virtual agent begins; you must send a subsequent request that includes both the agent
and customer
objects once the agent joins the conversation.CUSTOMER_TIMEZONE: <IANA time zone name>
id
) for the conversation. This identifier should be used whenever referencing this conversation in the future. For example, adding new messages to this conversation record will require use of this identifier so that ASAPP knows to which conversation messages should be added.
POST /conversation/v1/conversations/\{conversationId\}/messages
Use this endpoint to add a message to an existing conversation record.
When to Call
This service should be called after each sent message by a participant in the conversation.
role
; supported values include agent
, customer
, or system
for virtual agent messages.
Response Details
When successful, this endpoint responds with a unique ASAPP identifier (id
) for the message. This identifier should be used if a need arises to reference this message in the future.
POST /autocompose/v1/conversations/\{conversationId\}/suggestions
Use this endpoint to get suggestions for the next agent message in the conversation.
When to Call
This service should be called when an agent joins the conversation, after every agent keystroke, and after a message is sent by either the customer or the agent. In each of these instances, AutoCompose takes into account new conversation context (e.g. the next letter the agent typed) and will return suggestions suitable for that context.
/messages
endpoint.
query
).
To add a message to the conversation record during a suggestion request, you must also include a message object that contains the text of the sent message, the sender role and ID, and the timestamp for the sent message.
Response Details
When successful, this endpoint responds with a set of suggestions or phrase completions, and a unique ASAPP identifier (id
) that corresponds to this set of suggestions.
Full suggestions will be returned when the agent has not yet typed and early in the composition of their typed message. Once the agent’s typed message is sufficiently complete, no suggestions will be returned.
Phrase completions are only provided when a high-confidence phrase is available to complete a partially typed message with several words. If no such phrases fit the message, phrase completions will not be returned.
If a message object was included in the request body, the response will include a message object with a unique message identifier.
Metadata Inserts
Suggestions will always include messages with text
and templateText
fields. Text
fields contain the message as it should be shown in the end-user interface, whereas templateText
indicates where metadata was inserted into a templated part of the message.
For example, text
would read "Sure John"
and templateText
would read "Sure \{NAME\}"
. AutoCompose currently supports inserting metadata about a customer name or agent name into a templated suggestion.
templateText
will be returned even if there are no metadata elements being inserted into the suggestion text
. In these cases, the templateText
and text
will be identical.POST /autocompose/v1/profanity/evaluation
Use this endpoint to receive an evaluation of a text string to verify if it contains a word present on ASAPP’s profanity blocklist.
When to Call
This service should be called when a carriage return or “enter” is used to send an agent message in order to prevent sending profanities in the chat.
Request Details
Requests need only specify the text required to be checked for profanity
Response Details
When successful, this endpoint responds with a boolean indicating whether or not the submitted text contains profanity.
POST /autocompose/v1/spellcheck/correction
Use this endpoint to get a spelling correction for a message as it is being typed.
When to Call
This service should be called after a space character is entered, checking the most recently completed word in the sentence.
Request Details
Requests must include the text the agent has typed and the position of the cursor to indicate which word the agent has just typed to be checked for spelling.
The request may also specify a user dictionary of any words that should not be corrected if present.
Response Details
When successful and a spelling mistake is present, this endpoint identifies the misspelled text, the correct spelling of the word and start position of the cursor where the misspelled word begins so that it can be replaced.
POST /autocompose/v1/analytics/message-sent
Use this endpoint to create an analytics event describing the agent’s usage of AutoCompose for a given message. ASAPP uses these events to train AutoCompose, identifying which forms of augmentation should be credited for contributing to the final sent message.
When to Call
This service should be called after both of the following have occurred:
augmentationType
that describes the agent’s sequence of AutoCompose usage before sending the message. Valid augmentationType
values are described below:
augmentationType | When to Use |
---|---|
AUTOSUGGEST | When agent uses a full response suggestion with no text in the composer |
AUTOCOMPLETE | When agent uses a full response suggestion with text already in the composer |
PHRASE_AUTOCOMPLETE | When agent uses a phrase completion rather than a full response suggestion |
CUSTOM_DRAWER | When agent inserts a custom message from a drawer menu in the composer |
CUSTOM_INSERT | When agent inserts a custom message from a response panel |
GLOBAL_INSERT | When agent inserts a global message from a response panel |
FLUENCY_APPLY | When a fluency correction is applied to a word |
FLUENCY_UNDO | When a fluency correction is undone |
FREEHAND | When the agent types the entire message themselves and does not use any augmentation from AutoCompose |
GET /autocompose/v1/responses/globals
Use this endpoint to retrieve the global responses and associated folder organization.
When to Call
This service should be called to show an agent the global response list - the list of responses available to all agents - in a user interface in response to an action taken by the agent, such as clicking on a response panel icon or searching for a specific response.
Request Details
Requests must include the agent’s unique identifier from your system - this is the same identifier used to create conversation and conversation message records.
GET /autocompose/v1/responses/customs
Use this endpoint to retrieve the custom responses and associated folder organization.
When to Call
This service should be called to show an agent their custom response list - the list of responses available to only that agent - in a user interface in response to an action taken by the agent, such as clicking on a response panel icon or searching for a specific response.
Request Details
Requests must include the agent’s unique identifier from your system - this is the same identifier used to create conversation and conversation message records.
Requests may include parameters about what values the returned list should contain based on the context of the request:
POST /autocompose/v1/responses/customs/response
Use this endpoint to add a single custom response for an agent.
When to Call
This service should be called when an agent creates a new custom response.
Request Details
Requests must include the agent’s unique identifier from your system - this is the same identifier used to create conversation and conversation message records.
Requests must also include the text of the custom response and its title.
Requests may include the identifier of the folder in which the response should be stored; if not provided, the response is created at the __root folder level.
Requests may also specify metadata to be inserted into specific parts of the message, such as the customer or agent’s name.
Response Details
When successful, the endpoint responds with a unique ASAPP identifier for the response. This value should be used to update and delete the same response.
PUT /autocompose/v1/responses/customs/response/\{responseId\}
Use this endpoint to update a specific custom response for an agent.
When to Call
This service should be called once an agent edits a custom response.
Request Details
The path parameter for this request is the unique ASAPP response ID provided in the response body when creating the response.
Requests must also include the text and title values of the updated custom response.
Requests may include the identifier of the folder in which the response should be stored and may also specify metadata to be inserted into specific parts of the message, such as the customer or agent’s name.
Response Details
When successful, this endpoint confirms the update and returns no response body.
DELETE /autocompose/v1/responses/customs/response/\{responseId\}
Use this endpoint to delete a specific custom response for an agent.
When to Call
This service should be called when an agent deletes a response.
Request Details
The path parameter for this request is the unique ASAPP response ID provided in the response body when creating the response.
Requests must also include the agent’s unique identifier from your system.
Response Details
When successful, this endpoint confirms the deletion and returns no response body.
POST /autocompose/v1/responses/customs/folder
Use this endpoint to add a single folder for an agent.
When to Call
This service should be called when an agent creates a new custom response folder.
Request Details
Requests must include the agent’s unique identifier from your system - this is the same identifier used to create conversation and conversation message records.
Requests must also include the name of the custom response folder.
Requests may include the identifier of the parent folder in which to create the new folder.
Response Details
When successful, the endpoint responds with a unique ASAPP identifier for the folder. This value should be used to update and delete the same folder.
PUT /autocompose/v1/responses/customs/folder/\{folderId\}
Use this endpoint to update a specific folder for an agent.
When to Call
This service should be called once an agent edits the name or hierarchy location of the folder.
Request Details
The path parameter for this request is the unique ASAPP folder ID provided in the response body when creating the folder.
Requests must include the agent’s unique identifier from your system and the name of the folder once updated.
Requests may include the identifier of the folder in which the response should be stored if that parent folder has been updated.
Response Details
When successful, this endpoint confirms the update and returns no response body.
DELETE /autocompose/v1/responses/customs/folder/\{folderId\}
Use this endpoint to delete a specific folder for an agent.
When to Call
This service should be called when an agent deletes a folder.
Request Details
The path parameter for this request is the unique ASAPP folder ID provided in the folder body when creating the folder.
Requests must include the agent’s unique identifier from your system.
Response Details
When successful, this endpoint confirms the deletion and returns no response body.
Scenario | Expected Requests | |
---|---|---|
A | Start new chat for agent with pre-existing customer messages | POST /conversation POST /messages POST /suggestions |
B | Populate suggestions, select a suggestion and send | POST /suggestions POST /spellcheck POST /profanity POST /messages POST /message-sent |
C | Populate suggestions, don’t choose one and type “Hello” and send message | POST /suggestions POST /suggestions per keystroke POST /spellcheck POST /profanity POST /messages POST /message-sent |
D | Choose a suggestion and edit suggestion and select a phrase completion | POST /suggestions POST /suggestions per keystroke POST /spellcheck POST /profanity POST /messages POST /message-sent |
E | Choose a suggestion and add to it, purposely misspelling a word and undoing the spelling correction | POST /suggestions POST /suggestions per keystroke POST /spellcheck POST /profanity POST /messages POST /message-sent |
F | Choose a suggestion and edit with profanity | POST /suggestions POST /suggestions per keystroke POST /spellcheck POST /profanity POST /messages POST /message-sent |
id
value provided in the /conversations
response is used as the conversationId
path parameter in subsequent calls.
The conversation and message calls are followed by a suggestion request and response for the agent’s reply which includes two suggestions without a title and one suggestion with a title. The phraseCompletion
field is not returned, as the agent has only just begun typing their message with "query": "Sure"
when this suggestion request was made.
POST /conversation/v1/conversations
Request
/conversation/v1/conversations/5544332211/messages
Request
/autocompose/v1/conversations/5544332211/suggestions
Request
/autocompose/v1/profanity/evaluation
Request
/autocompose/v1/spellcheck/correction
Request
/autocompose/v1/analytics/message-sent
Request
/autocompose/v1/responses/globals
Request
Query Parameters:
/autocompose/v1/responses/customs/response
Request
/autocompose/v1/responses/customs/response/425523523523
Request