ResponseTemplate - Scoped, Global
-
- UpdatedFeb 1, 2024
- 5 minutes to read
- Washington DC
- API reference
The ResponseTemplate API provides methods for managing response templates.
Response templates are reusable messages that agents can copy to case or task forms. They
provide quick and consistent messages to users and display standard chat response messages to
requesters in Agent Chat. This API requires the Templated Responses
plugin (com.sn_templated_snip), which is activated by default. This API is provided
within the sn_templated_snip
namespace.
For additional information on response templates, see Response templates.
ResponseTemplate - ResponseTemplate()
Instantiates a new ResponseTemplate object.
Name | Type | Description |
---|---|---|
None |
Example
ResponseTemplate - query(String tableName, String recordId, String searchTerm, Number limit, Number offset, Boolean includeEvaluatedBody, String errorFormat, Object opts)
Returns all response templates from a specified table that match the passed in query criteria.
Type | Description |
---|---|
Object | Array of all templates that match the specified search criteria. Response
templates with exact matches on short name appear first in the return results. All
other returned response templates are sorted by name. Each node in the Array may contain the following parameters:
|
Example
This example shows how to query for response templates associated with the incident table.
Successful response:
Example
Same query with an error response.
Error response:
ResponseTemplate - render(String templateId, String tableName, String recordId, String errorFormat, Object opts)
Renders the HTML body of a specified response template.
During rendering, all variables are resolved using the information from the specified table and record. If variables cannot be resolved, or any other problem occurs during rendering, the method returns an error message in the results.
Type | Description |
---|---|
Object | Results of the render.
|
Example
This code example shows how to request a rendered response template for the incident table.
Successful response:
Example
Same render request but returning an error response.
Error response:
On this page
- ResponseTemplate - ResponseTemplate()
- ResponseTemplate - query(String tableName, String recordId, String searchTerm, Number
limit, Number offset, Boolean includeEvaluatedBody, String errorFormat, Object opts)
- ResponseTemplate - render(String templateId, String tableName, String recordId, String
errorFormat, Object opts)