Deploying AutoCompose API
Communicate with AutoCompose via API.
ASAPP AutoCompose has the following technical components:
- An autosuggest model that ASAPP retrains weekly with agent usage data you provide through the
/analytics/message-sent
endpoint - Data storage for historical conversations, global response lists and agent historical feature usage that are used for weekly retraining
- The Conversation API for creating and updating conversation data and the AutoCompose API that interfaces with the application with which agents interact and receives agent usage data in the form of message analytics events
Setup
ASAPP provides an AI Services Developer Portal. Within the portal, developers can do the following:
- Access relevant API documentation (e.g. OpenAPI reference schemas)
- Access API keys for authorization
- Manage user accounts and apps
In order to use ASAPP’s APIs, all apps must be registered through the portal. Once registered, each app will be provided unique API keys for ongoing use.
Visit the Get Started page on the Developer Portal for instructions on creating a developer account, managing teams and apps, and setup for using AI Service APIs.
Usage
ASAPP AutoCompose exposes API endpoints that each enable distinct features in the course of an agent’s message composition workflow. Requests should be sent to each endpoint based on events in the conversation and actions taken by the agent in their interface.
For example, the sequence below shows requests made for a typical new conversation in which the agent begins creating their first message, sends the first message and receives one message in return from an end-customer:
This example is not comprehensive of every possible endpoint request supported by AutoCompose. Refer to the Endpoints section for a full listing of endpoints.
In this example:
Conversation 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 |
The Endpoints section below outlines how to use each endpoint.
Endpoints Listing
For all requests, you must provide a header containing the 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
.
Use the links below to skip to information about the relevant fields and parameters for the corresponding endpoint(s):
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
Updating Custom Response Lists
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\}
Conversations API
ASAPP receives conversations through POST requests to the Conversations API. This service creates a record of conversations referenced as a source of truth by all ASAPP services.
By promptly sending conversation and message data to this API, you ensure that ASAPP’s conversation records match your own and that ASAPP services use the most current information available.
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:
- Conversations started with an agent: Provide both the
agent
andcustomer
objects in the request when the conversation begins. - Conversations started with a virtual agent: Provide only the
customer
object in the initial request when the conversation with the virtual agent begins; you must send a subsequent request that includes both theagent
andcustomer
objects once the agent joins the conversation.
Requests may also include key-value pair metadata for the conversation that can be used either (1) to insert values into templated responses for agents or (2) as filter criteria to determine whether a conversation is eligible for specific response suggestions.
To support inserting the customer’s time of day (morning, afternoon, evening) into templated agent responses, conversation metadata key-value pairs should take the format of CUSTOMER_TIMEZONE: <IANA time zone name>
Response Details
When successful, this endpoint responds with a unique ASAPP identifier (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.
If a conversation begins with messages between a customer and virtual agent/bot, ensure the conversation record is updated once the agent joins the conversation, prior to posting messages to this endpoint for the agent.
Request Details
The path parameter for this request is the unique ASAPP conversation ID that was provided in the response body when the conversation record was initially created.
Requests must include the message’s text and the message’s sent timestamp (formatted in RFC3339 micro second date-time expressed in UTC).
Requests must also include identifying information about the sender of the message, including their 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.
When a conversation message is posted, ASAPP applies redaction to the message text to prevent storage of sensitive information. Visit the Data Redaction section to learn more. Reach out to your ASAPP account contact for information on available redaction capabilities to configure for your implementation.
Requesting Suggestions
ASAPP provides suggestions through one POST request to the AutoCompose API.
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.
If a conversation begins with messages between a customer and virtual agent/bot, ensure the conversation record is updated once the agent joins the conversation. Suggestion requests to this endpoint will fail if no agent is associated with a conversation.
While making a request for a suggestion, a new sent message by either the customer or agent can be posted to the conversation record by including it in the request body. This optional approach to updating the conversation record is in lieu of sending a separate request to the /messages
endpoint.
New messages cannot be added to the conversation record using the suggestions endpoint if no agent is associated with the conversation.
Request Details
The path parameter for this request is the unique ASAPP conversation ID that was provided in the response body when the conversation record was initially created.
Requests must include any text that the agent has already typed (called the 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.
Check Profanity & Spelling
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.
Sending Agent Usage Data
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:
- A message has been submitted by an agent
- A successful request has been made to add this message to ASAPP’s record of the conversation
Message sent analytics events should be posted after every agent message regardless of whether any AutoCompose capabilities were used.
Request Details
Requests must include the ASAPP identifiers for the conversation and the specific message about which the analytics data is about.
Requests must also include an array called 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 |
Requests should include identifiers for the initial set of suggestions shown to the agent and the last set of suggestions where the agent made a selection (if any selections were made). If a selection was made, the index of the selected message (from the list of three) should also be specified.
Requests may also include further metadata describing the agents editing keystrokes after selecting a suggestion, their time crafting and waiting to send the message, the time between the last sent message and their first action, and their interactions with phrase completion suggestions (if relevant).
Response Details
When successful, this endpoint confirms the analytics message event was received and returns no response body.
Getting Response Lists
ASAPP provides access to the global response list and agent-specific custom response lists through GET requests to two endpoints. Each endpoint is designed to be used to show an agent the contents of the response list in a user interface as they browse or search the list.
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.
- Only values within a specific folder
- Only responses, only folders, or both
- Only values that match an agent search term
Requests can be returned in multiple pages based on a maximum per page parameter set to ensure a user interface only receives the number responses it can support. This endpoint can be called again with the same query parameters and a pageToken to indicate which page to retrieve in a multi-page list.
Response Details
When successful, this endpoint responds with a response list (if requested) that fits the criteria of the request query parameters, including the id of the response along with the text, title, corresponding folder to which it belongs and any key-value pair metadata associated with the response.
As discussed previously in Metadata Inserts, responses can be templated to insert metadata into specific parts of the message, such as the customer or agent’s name. ASAPP can also use metadata associated with a response (e.g. agent skills for which that response is allowed) to filter out that response from suggestions for a given conversation.
If there is a next page to the response list, a pageToken is provided in the response for use in a subsequent call to show the next page to the user.
This endpoint also responds with a folder list (if requested) including the identifier of the folder, its name, and parent folder (if one exists), and version information about the global list of responses from which this list is sourced.
Global responses are returned in alphabetical order, sorted on the text of the response. Folders are sorted by folder name.
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:
- Only values within a specific folder
- Only responses, only folders, or both
- Only values that match an agent search term
Requests can be returned in multiple pages based on a maximum per page parameter set to ensure a user interface only receives the number responses it can support. This endpoint can be called again with the same query parameters and a pageToken to indicate which page to retrieve in a multi-page list.
Response Details
When successful, this endpoint responds with a response list (if requested) that fits the criteria of the request query parameters, including the identifier of the response along with the text, title, corresponding folder to which it belongs and any key-value pair metadata associated with the response.
As discussed previously in Metadata Inserts, responses can be templated to insert metadata into specific parts of the message, such as the customer or agent’s name. ASAPP can also use metadata associated with a response (e.g. agent skills/queues for which that response is allowed) to filter out that response from suggestions for a given conversation.
If there is a next page to the response list, a pageToken is provided in the response for use in a subsequent call to show the next page to the user.
This endpoint also responds with a folder list (if requested) including the identifier of the folder, its name, and parent folder (if one exists).
Custom responses are returned in alphabetical order, sorted on the title of the response. Folders are sorted by folder name.
Updating Custom Response Lists
Each agent’s custom responses and the related folders can be added, updated and deleted using six endpoints. These endpoints are designed to carry out actions taken by agents in their personal list management interface.
For Responses
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.
For Folders
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.
Certification
Before providing credentials for applications to use production services, ASAPP reviews your completed integration in the sandbox environment to certify that your application is ready.
The following criteria are used to certify that the integration is ready to use the AutoCompose API in a production environment:
- Under normal conditions, the integration is free of errors
- Under abnormal conditions, the integration provides the correct details in order to troubleshoot the issue
- The correct analytics events are being provided for agent messages that are sent
To test these criteria, an ASAPP Solution Architect will review these AutoCompose functionalities:
- Load a new customer conversation onto the agent desktop/view (with existing customer messages)
- Present the agent with suggestions and enable them to select an option and send
- Enable the agent to modify or add to a selected suggestion, and then send
- Enable the agent to freely type and use a phrase completion
- Enable the agent to use the spell check and profanity functionality
- Verify that correct analytics details are sent to ASAPP when an agent sends a message
- Disable API Keys in developer.asapp.com and generate an error message
The following are the test scenarios and accompanying sequence of expected API requests:
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 |
Use Case Examples
1. Create a Conversation and Ask for Suggestions
The example below is a conversation post request with one customer message. Notice that the 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
Response
STATUS 200: Successfully created or updated conversation
POST /conversation/v1/conversations/5544332211/messages
Request
Response STATUS 200: Successfully created message in conversation
POST /autocompose/v1/conversations/5544332211/suggestions
Request
Response STATUS 200: Successfully fetched suggestions for the conversation
2. Check Profanity
The example below is of a profanity check request and response for a text string that does not contain any words found in the profanity blocklist:
POST /autocompose/v1/profanity/evaluation
Request
Response
STATUS 200: Successfully fetched an evaluation result of the sentence.
3. Check Spelling
The example below is of a spell check request and response for a text string that contains a misspelling in the last typed word of the string:
POST /autocompose/v1/spellcheck/correction
Request
Response
STATUS 200: Successfully checked for a spelling mistake.
4. Send an Analytics Message Event
The example below is of an analytics message event being sent to ASAPP that provides metadata about how an agent used AutoCompose for a given message.
For this message example, the agent used a spelling correction, selected the first response suggestion offered, and subsequently used the first phrase completion presented to finish the sentence, in that order.
POST /autocompose/v1/analytics/message-sent
Request
Response STATUS 200: Successfully created a MessageSent event. In this example, the agent typed a message and sent it without using any assistance from AutoCompose: Request
Response
STATUS 200: Successfully created a MessageSent event.
In this example, the agent typed “hel”, selected the second suggestion presented to them and sent it:
Request
Response STATUS 200: Successfully created a MessageSent event. In this example, the agent typed “htis”, hit the space bar, and spellcheck corrected the text to “this”. Then the agent accidentally reversed the spell check and sent the message to the customer without using any other AutoCompose assistance: Request
Response
STATUS 200: Successfully created a MessageSent event.
5. Show an Agent Global Responses
The example below is of a request to show global responses only to an agent who is searching the greetings folder for a particular response. NOTE: The response below is shortened to show two responses.
GET /autocompose/v1/responses/globals
Request
Query Parameters:
Response
STATUS 200: The global responses for this company
6. Creating a New Custom Response Folder and Response
The example below shows the calls that would accompany an agent creating a new greeting custom response without a folder, then adding it to an existing folder.
POST /autocompose/v1/responses/customs/response
Request
Response
STATUS 200: Acknowledgement that the response was successfully added
PUT /autocompose/v1/responses/customs/response/425523523523
Request
Response
STATUS 201: Acknowledgement that the custom response was successfully updated
Data Security
ASAPP’s security protocols protect data at each point of transmission, from first user authentication, to secure communications, to our auditing and logging system, all the way to securing the environment when data is at rest in the data logging system. Access to data by ASAPP teams is tightly constrained and monitored. Strict security protocols protect both ASAPP and our customers.
The following security controls are particularly relevant to AutoCompose:
- Client sessions are controlled using a time-limited authorization token. Privileges for each active session are controlled server-side to mitigate potential elevation-of-privilege and information disclosure risks.
- To avoid unauthorized disclosure of information, unique, non-guessable IDs are used to identify conversations. These conversations can only be accessed using a valid client session.
- Requests to API endpoints that can potentially receive sensitive data are put through a round of redaction to strip the request of sensitive data (like SSNs and phone numbers).
Additional Considerations
Historical Conversation Data for Generating a Response List
ASAPP uses past agent conversations to generate a customized response list tailored to a given use case. In order to create an accurate and relevant list, ASAPP requires a minimum of 200,000 historical transcripts to be supplied ahead of implementing AutoCompose.
For more information on how to transmit the conversation data, reach out to your ASAPP account contact.
Visit Transmitting Data to SFTP for instructions on how to send historical transcripts to ASAPP.
Was this page helpful?