Create a new canned response.
| HTTP Method | URL | Requires Auth |
|---|---|---|
POST | /api/v1/canned-responses | yes |
{% hint style="info" %} Permissions required:
save-canned-responsessave-all-canned-responses{% endhint %}
| Key | Example Value | Description |
|---|---|---|
shortcut* | card-declined | The shortcut to trigger the message snippet. |
text* | reasons for your card malfunction | The message snippet. |
scope* | global | The scope of the canned response. It can either be global, user or department. |
tags | card | The tags for your canned response. |
departmentId | 64181a0728384134ed600dcc | The departmentId where the canned response belongs to. It is required if the scope is department. |
curl --location 'http://localhost:3000/api/v1/canned-responses' \
--header 'X-User-Id: 2tTEqR7ZNMJ4HGGNa' \
--header 'X-Auth-Token: A6PF2Qa-wXunBXi3j77OBY-T-gl1BvJ11jYiSMt6Z_G' \
--header 'Content-Type: application/json' \
--data '{
"shortcut": "test-canned",
"text": "This is an example test for canned response",
"scope": "global",
"tags": ["tag1", "tag2"]
}'{
"success": true
}Any of the following errors can occur on the endpoint.
- Authorization: Requires an authentication token for the request to be made.
- No Permission: Occurs when the authenticated user doesn't have the
save-canned-responsesandsave-all-canned-responsespermission. - Invalid Department: If the
scopeof the canned response isdepartment, a validdepartmentIdis required to specify the department it belongs to. This error occurs when there is no validdepartmentIdin the body of the request. - Shortcut Exists: The
shortcutvalue of the canned response must be unique. This error occurs when the shortcut already exists.
{% tabs %} {% tab title="Authorization" %}
{
"status": "error",
"message": "You must be logged in to do this."
}{% endtab %}
{% tab title="No Permission" %}
{
"success": false,
"error": "User does not have the permissions required for this action [error-unauthorized]"
}{% endtab %}
{% tab title="Invalid Department" %}
{
"success": false,
"error": "Invalid department [error-invalid-department]",
"errorType": "error-invalid-department",
"details": {
"method": "saveCannedResponse"
}
}{% endtab %}
{% tab title="Shortcut Exists" %}
{
"success": false,
"error": "Shortcut provided already exists [error-invalid-shortcut]",
"errorType": "error-invalid-shortcut",
"details": {
"method": "saveCannedResponse"
}
}{% endtab %} {% endtabs %}
| Version | Description |
|---|---|
| 1.0.0 | Added |