--- title: "Trigger" slug: "server-api-ticketing-trigger" updated: 2022-06-16T07:35:53Z published: 2022-06-16T07:35:53Z canonical: "developer.comm100.com/server-api-ticketing-trigger" --- > ## Documentation Index > Fetch the complete documentation index at: https://developer.comm100.com/llms.txt > Use this file to discover all available pages before exploring further. # Trigger ## Trigger Triggers allow you to automatically update your tickets, or send automatic follow-up emails based on predefined conditions. If a ticket meets more than one trigger rule, the triggers will work in sequence based on their display order. - `Triggers` - Triggers Manage - `GET ticketing/triggers` - [Get the list of Triggers](/docs/server-api-ticketing-trigger#get-the-list-of-triggers) - `GET ticketing/triggers/{id}` - [Get a single Trigger](/docs/server-api-ticketing-trigger#get-a-single-trigger) - `POST ticketing/triggers` - [Create a new Trigger](/docs/server-api-ticketing-trigger#create-a-new-trigger) - `POST ticketing/triggers/{id}:disable` - [Disable the Trigger](/docs/server-api-ticketing-trigger#disable-the-trigger) - `POST ticketing/triggers/{id}:enable` - [Enable the Trigger](/docs/server-api-ticketing-trigger#enable-the-trigger) - `PUT ticketing/triggers/{id}` - [Update the Trigger](/docs/server-api-ticketing-trigger#update-the-trigger) - `DELETE ticketing/triggers/{id}` - [Remove the Trigger](/docs/server-api-ticketing-trigger#remove-the-trigger) ### Trigger JSON Format Trigger is represented as simple flat JSON objects with the following keys: | Name | Type | Description | | --- | --- | --- | | `id` | guid | Id of the trigger. | | `name` | string | Name of the trigger. | | `description` | string | Description of the trigger. | | `isEnabled` | bool | Whether the trigger is enabled or not. | | `order` | integer | Order of the trigger. | | `event` | string | Events of the tickets. Allowed values are "whenTicketIsCreated", "whenATicketReplyIsReceived", "WhenAnAgentReplied", "whenTheAssigneeOfATicketHasChanged", "whenTheStatusOfATicketHasChanged", "whenATicketStatusStaysTheSameForASpecifiedPeriodOfTime". | | `status` | string | When the status of a ticket match the value, the trigger will work. Allowed values are "new", "pendingInternal", "pendingExternal", "onHold", "resolved". | | `statusDuration` | integer | How long dose a ticket stay at one status. | | `isValueSettingEnabled` | bool | Whether set value action is enabled or not. | | `conditionMetType` | string | How conditions are matched. Allowed values are "any", "all", "logicalExpression". | | `logicalExpression` | string | Logical expression to match the conditions i.e., (1 or 2 or 3) and (4 and 5). | | `ifSendEmail` | bool | Whether to send email or not. | | `ifSendEmailToContact` | bool | Whether send email to the ticket contact or not. | | `ifSendEmailToAgent` | bool | Whether sending email to agent or not. | | `ifDisplayInTicketCorrespondences` | bool | With this option enabled, the trigger email will be included within a ticket's correspondence thread. | | `ifSendEmailToAssignedAgent` | bool | Whether send email to the selected agents or not. | | `triggerConditions` | [triggerConditions[]](/docs/server-api-ticketing-trigger#trigger-condition-json-format) | Reference to Trigger Condition. | | `triggerActionUpdateFields` | [triggerActionUpdateFields[]](/docs/server-api-ticketing-trigger#trigger-action-update-field-json-format) | Reference to Trigger Action Update Field. | | `triggerActionEmailContent` | [triggerActionEmailContent](/docs/server-api-ticketing-trigger#trigger-action-email-content-json-format) | Reference to Trigger Action Email Content. | | `agentIds` | array | The list of agent that the trigger email are sent to. | ### Trigger Action Email Content JSON Format: | Name | Type | Description | | --- | --- | --- | | `triggerId` | guid | Id of the trigger. | | `subject` | string | Subject of the trigger email. | | `htmlBody` | string | HTML body of the trigger email. You can pass both plaintext and base64 encoded text. If the request containing plaintext is blocked by comm100 WAF, use base64 format. When using base64, add "data:text/plain;base64," before the content. | | `textBody` | string | Text body of the trigger email. You can pass both plaintext and base64 encoded text. If the request containing plaintext is blocked by comm100 WAF, use base64 format. When using base64, add "data:text/plain;base64," before the content. | ### Trigger Action Update Field JSON Format: | Name | Type | Description | | --- | --- | --- | | `id` | guid | Id of the trigger action set value field. | | `triggerId` | guid | Id of the trigger. | | `fieldName` | string | Name of the ticketing field you want to set value for. | | `value` | string | Value of the trigger action field. | ### Trigger Condition JSON Format: | Name | Type | Description | | --- | --- | --- | | `id` | guid | Id of the trigger condition. | | `triggerId` | guid | Id of the trigger. | | `fieldName` | string | Name of the ticketing field you want to set value for. | | `operator` | string | How value for this condition field is matched. Allowed values are "contains", "notContains", "is", "isNot", "isMoreThan", "isLessThan", "before", "after", "regularExpression", "isOneOf", "isNotIn". | | `value` | string | Value of the condition field. | | `order` | integer | Order of the trigger condition. | ### Get the list of Triggers `GET ticketing/triggers` - #### Parameters: | Name | Type | in | Required | Description | | --- | --- | --- | --- | --- | | `include` | string | query | no | Allowed values are "triggerCondition", "triggerActionUpdateField", "agent", "triggerActionEmailContent". | - #### Response: An array of [Trigger](/docs/server-api-ticketing-trigger#trigger-json-format) - #### Example Sample Request: ``` curl https://api11.comm100.io/v4/ticketing/triggers \ -X 'GET' \ -H 'Authorization: Bearer {access_token}' \ ``` Response: HTTP/1.1 200 OK ``` { "triggers": [ { "id": "18668adf-d440-490a-a049-520a8bd50874", "name": "Trigger example", "description": "The example of trigger", "isEnabled": true, "order": 1, "event": "whenTheAssigneeOfATicketHasChanged", "status": "new", "statusDuration": 0, "isValueSettingEnabled": true, "conditionMetType": "all", "logicalExpression": "", "ifSendEmail": true, "ifSendEmailToContact": true, "ifSendEmailToAgent": true, "ifDisplayInTicketCorrespondences": true, "ifSendEmailToAssignedAgent": true, "triggerConditions": [ { "id": "2c48c435-7c6d-489c-9136-2f92b7b8417f", "triggerId": "18668adf-d440-490a-a049-520a8bd50874", "fieldName": "{!Ticket.Subject}", "operator": "contains", "value": "example", "order": 1 } ], "triggerActionUpdateFields": [ { "id": "ecf38313-fbcc-4d31-b3c5-96f1ec5d1ae0", "triggerId": "18668adf-d440-490a-a049-520a8bd50874", "fieldName": "{!Ticket.Status}", "value": "resolved" } ], "triggerActionEmailContent": { "triggerId": "18668adf-d440-490a-a049-520a8bd50874", "subject": "The example of trigger email", "htmlBody": "data:text/plain;base64,PHA+MTExPC9wPg==", "textBody": "data:text/plain;base64,MTEx" }, "agentIds": [ "1487fc9d-92e6-4487-a2e8-92e68d6892e6" ] } ], "nextPage": null, "previousPage": null, "total": 1 } ``` ### Get a single Trigger `GET ticketing/triggers/{id}` - #### Parameters: | Name | Type | in | Required | Description | | --- | --- | --- | --- | --- | | `include` | string | query | no | Allowed values are "triggerCondition", "triggerActionUpdateField", "agent", "triggerActionEmailContent". | - #### Response: [Trigger](/docs/server-api-ticketing-trigger#trigger-json-format) - #### Example Sample Request: ``` curl https://api11.comm100.io/v4/ticketing/triggers/18668adf-d440-490a-a049-520a8bd50874 \ -X 'GET' \ -H 'Authorization: Bearer {access_token}' \ ``` Response: HTTP/1.1 200 OK ``` { "id": "18668adf-d440-490a-a049-520a8bd50874", "name": "Trigger example", "description": "The example of trigger", "isEnabled": true, "order": 1, "event": "whenTheAssigneeOfATicketHasChanged", "status": "new", "statusDuration": 0, "isValueSettingEnabled": true, "conditionMetType": "all", "logicalExpression": "", "ifSendEmail": true, "ifSendEmailToContact": true, "ifSendEmailToAgent": true, "ifDisplayInTicketCorrespondences": true, "ifSendEmailToAssignedAgent": true, "triggerConditions": [ { "id": "2c48c435-7c6d-489c-9136-2f92b7b8417f", "triggerId": "18668adf-d440-490a-a049-520a8bd50874", "fieldName": "{!Ticket.Subject}", "operator": "contains", "value": "example", "order": 1 } ], "triggerActionUpdateFields": [ { "id": "ecf38313-fbcc-4d31-b3c5-96f1ec5d1ae0", "triggerId": "18668adf-d440-490a-a049-520a8bd50874", "fieldName": "{!Ticket.Status}", "value": "resolved" } ], "triggerActionEmailContent": { "triggerId": "18668adf-d440-490a-a049-520a8bd50874", "subject": "The example of trigger email", "htmlBody": "data:text/plain;base64,PHA+MTExPC9wPg==", "textBody": "data:text/plain;base64,MTEx" }, "agentIds": [ "1487fc9d-92e6-4487-a2e8-92e68d6892e6" ] } ``` ### Create a new Trigger `POST ticketing/triggers` - #### Parameters: | Name | Type | in | Required | Description | | --- | --- | --- | --- | --- | | `name` | string | body | yes | Name of the trigger. | | `description` | string | body | no | Description of the trigger. | | `isEnabled` | bool | body | yes | Whether the trigger is enabled or not. | | `order` | integer | body | no | Order of the trigger. | | `event` | string | body | yes | Events of the tickets. Allowed values are "whenTicketIsCreated", "whenATicketReplyIsReceived", "WhenAnAgentReplied", "whenTheAssigneeOfATicketHasChanged", "whenTheStatusOfATicketHasChanged", "whenATicketStatusStaysTheSameForASpecifiedPeriodOfTime". | | `status` | string | body | yes | When the status of a ticket match the value, the trigger will work. Allowed values are "new", "pendingInternal", "pendingExternal", "onHold", "resolved". | | `statusDuration` | integer | body | no | How long dose a ticket stay at one status. | | `isValueSettingEnabled` | bool | body | yes | Whether set value action is enabled or not. | | `conditionMetType` | string | body | yes | How conditions are matched. Allowed values are "any", "all", "logicalExpression". | | `logicalExpression` | string | body | no | Logical expression to match the conditions i.e., (1 or 2 or 3) and (4 and 5). | | `ifSendEmail` | bool | body | yes | Whether to send email or not. | | `ifSendEmailToContact` | bool | body | yes | Whether send email to the ticket contact or not. | | `ifSendEmailToAgent` | bool | body | yes | Whether sending email to agent or not. | | `ifDisplayInTicketCorrespondences` | bool | body | no | With this option enabled, the trigger email will be included within a ticket's correspondence thread. | | `ifSendEmailToAssignedAgent` | bool | body | yes | Whether send email to the selected agents or not. | | `triggerActionEmailContent` | [triggerActionEmailContent](/docs/server-api-ticketing-trigger#trigger-action-email-content-json-format) | body | no | Email content of trigger email. | | `triggerActionUpdateFields` | [triggerActionUpdateFields[]](/docs/server-api-ticketing-trigger#trigger-action-update-field-json-format) | body | no | Set Value of trigger. | | `triggerConditions` | [triggerConditions[]](/docs/server-api-ticketing-trigger#trigger-condition-json-format) | body | no | Condition of trigger. | | `agentIds` | array | body | no | The list of agent that the trigger email are sent to. | - #### Response: [Trigger](/docs/server-api-ticketing-trigger#trigger-json-format) - #### Example Sample Request: ``` curl https://api11.comm100.io/v4/ticketing/triggers \ -X 'POST' \ -H 'Authorization: Bearer {access_token}' \ -H 'Content-Type: application/json' \ -D '{"name":"Trigger example","description":"The example of trigger","isEnabled":true,"order":1,"event":"whenTheAssigneeOfATicketHasChanged","status":"new","statusDuration":0,"isValueSettingEnabled":true,"conditionMetType":"all","logicalExpression":"","ifSendEmail":true,"ifSendEmailToContact":true,"ifSendEmailToAgent":true,"ifDisplayInTicketCorrespondences":true,"ifSendEmailToAssignedAgent":true,"triggerActionEmailContent":{"subject":"The example of trigger email","htmlBody":"data:text/plain;base64,PHA+MTExPC9wPg==","textBody":"data:text/plain;base64,MTEx"},"triggerActionUpdateFields":[{"fieldName":"{!Ticket.Status}","value":"resolved"}],"triggerConditions":[{"fieldName":"{!Ticket.Subject}","operator":"contains","value":"example","order":1}]}' ``` Response: HTTP/1.1 201 Created ``` { "id": "18668adf-d440-490a-a049-520a8bd50874", "name": "Trigger example", "description": "The example of trigger", "isEnabled": true, "order": 1, "event": "whenTheAssigneeOfATicketHasChanged", "status": "new", "statusDuration": 0, "isValueSettingEnabled": true, "conditionMetType": "all", "logicalExpression": "", "ifSendEmail": true, "ifSendEmailToContact": true, "ifSendEmailToAgent": true, "ifDisplayInTicketCorrespondences": true, "ifSendEmailToAssignedAgent": true, "triggerConditions": [ { "id": "2c48c435-7c6d-489c-9136-2f92b7b8417f", "triggerId": "18668adf-d440-490a-a049-520a8bd50874", "fieldName": "{!Ticket.Subject}", "operator": "contains", "value": "example", "order": 1 } ], "triggerActionUpdateFields": [ { "id": "ecf38313-fbcc-4d31-b3c5-96f1ec5d1ae0", "triggerId": "18668adf-d440-490a-a049-520a8bd50874", "fieldName": "{!Ticket.Status}", "value": "resolved" } ], "triggerActionEmailContent": { "triggerId": "18668adf-d440-490a-a049-520a8bd50874", "subject": "The example of trigger email", "htmlBody": "data:text/plain;base64,PHA+MTExPC9wPg==", "textBody": "data:text/plain;base64,MTEx" }, "agentIds": [ "1487fc9d-92e6-4487-a2e8-92e68d6892e6" ] } ``` ### Disable the Trigger `POST ticketing/triggers/{id}:disable` - #### Parameters: No Parameters - #### Response: [Trigger](/docs/server-api-ticketing-trigger#trigger-json-format) - #### Example Sample Request: ``` curl https://api11.comm100.io/v4/ticketing/triggers/18668adf-d440-490a-a049-520a8bd50874:disable \ -X 'POST' \ -H 'Authorization: Bearer {access_token}' \ ``` Response: HTTP/1.1 200 OK ``` { "id": "18668adf-d440-490a-a049-520a8bd50874", "name": "Trigger example", "description": "The example of trigger", "isEnabled": false, "order": 1, "event": "whenTheAssigneeOfATicketHasChanged", "status": "new", "statusDuration": 0, "isValueSettingEnabled": true, "conditionMetType": "all", "logicalExpression": "", "ifSendEmail": true, "ifSendEmailToContact": true, "ifSendEmailToAgent": true, "ifDisplayInTicketCorrespondences": true, "ifSendEmailToAssignedAgent": true, "triggerConditions": [ { "id": "2c48c435-7c6d-489c-9136-2f92b7b8417f", "triggerId": "18668adf-d440-490a-a049-520a8bd50874", "fieldName": "{!Ticket.Subject}", "operator": "contains", "value": "example", "order": 1 } ], "triggerActionUpdateFields": [ { "id": "ecf38313-fbcc-4d31-b3c5-96f1ec5d1ae0", "triggerId": "18668adf-d440-490a-a049-520a8bd50874", "fieldName": "{!Ticket.Status}", "value": "resolved" } ], "triggerActionEmailContent": { "triggerId": "18668adf-d440-490a-a049-520a8bd50874", "subject": "The example of trigger email", "htmlBody": "data:text/plain;base64,PHA+MTExPC9wPg==", "textBody": "data:text/plain;base64,MTEx" }, "agentIds": [ "1487fc9d-92e6-4487-a2e8-92e68d6892e6" ] } ``` ### Enable the Trigger `POST ticketing/triggers/{id}:enable` - #### Parameters: No Parameters - #### Response: [Trigger](/docs/server-api-ticketing-trigger#trigger-json-format) - #### Example Sample Request: ``` curl https://api11.comm100.io/v4/ticketing/triggers/18668adf-d440-490a-a049-520a8bd50874:enable \ -X 'POST' \ -H 'Authorization: Bearer {access_token}' \ ``` Response: HTTP/1.1 200 OK ``` { "id": "18668adf-d440-490a-a049-520a8bd50874", "name": "Trigger example", "description": "The example of trigger", "isEnabled": true, "order": 1, "event": "whenTheAssigneeOfATicketHasChanged", "status": "new", "statusDuration": 0, "isValueSettingEnabled": true, "conditionMetType": "all", "logicalExpression": "", "ifSendEmail": true, "ifSendEmailToContact": true, "ifSendEmailToAgent": true, "ifDisplayInTicketCorrespondences": true, "ifSendEmailToAssignedAgent": true, "triggerConditions": [ { "id": "2c48c435-7c6d-489c-9136-2f92b7b8417f", "triggerId": "18668adf-d440-490a-a049-520a8bd50874", "fieldName": "{!Ticket.Subject}", "operator": "contains", "value": "example", "order": 1 } ], "triggerActionUpdateFields": [ { "id": "ecf38313-fbcc-4d31-b3c5-96f1ec5d1ae0", "triggerId": "18668adf-d440-490a-a049-520a8bd50874", "fieldName": "{!Ticket.Status}", "value": "resolved" } ], "triggerActionEmailContent": { "triggerId": "18668adf-d440-490a-a049-520a8bd50874", "subject": "The example of trigger email", "htmlBody": "data:text/plain;base64,PHA+MTExPC9wPg==", "textBody": "data:text/plain;base64,MTEx" }, "agentIds": [ "1487fc9d-92e6-4487-a2e8-92e68d6892e6" ] } ``` ### Update the Trigger `PUT ticketing/triggers/{id}` - #### Parameters: | Name | Type | in | Required | Description | | --- | --- | --- | --- | --- | | `name` | string | body | yes | Name of the trigger. | | `description` | string | body | no | Description of the trigger. | | `isEnabled` | bool | body | yes | Whether the trigger is enabled or not. | | `order` | integer | body | no | Order of the trigger. | | `event` | string | body | yes | Events of the tickets. Allowed values are "whenTicketIsCreated", "whenATicketReplyIsReceived", "WhenAnAgentReplied", "whenTheAssigneeOfATicketHasChanged", "whenTheStatusOfATicketHasChanged", "whenATicketStatusStaysTheSameForASpecifiedPeriodOfTime". | | `status` | string | body | yes | When the status of a ticket match the value, the trigger will work. Allowed values are "new", "pendingInternal", "pendingExternal", "onHold", "resolved". | | `statusDuration` | integer | body | no | How long dose a ticket stay at one status. | | `isValueSettingEnabled` | bool | body | yes | Whether set value action is enabled or not. | | `conditionMetType` | string | body | yes | How conditions are matched. Allowed values are "any", "all", "logicalExpression". | | `logicalExpression` | string | body | no | Logical expression to match the conditions i.e., (1 or 2 or 3) and (4 and 5). | | `ifSendEmail` | bool | body | yes | Whether to send email or not. | | `ifSendEmailToContact` | bool | body | yes | Whether send email to the ticket contact or not. | | `ifSendEmailToAgent` | bool | body | yes | Whether sending email to agent or not. | | `ifDisplayInTicketCorrespondences` | bool | body | no | With this option enabled, the trigger email will be included within a ticket's correspondence thread. | | `ifSendEmailToAssignedAgent` | bool | body | yes | Whether send email to the selected agents or not. | | `triggerActionEmailContent` | [triggerActionEmailContent](/docs/server-api-ticketing-trigger#trigger-action-email-content-json-format) | body | no | Email content of trigger email. | | `triggerActionUpdateFields` | [triggerActionUpdateFields[]](/docs/server-api-ticketing-trigger#trigger-action-update-field-json-format) | body | no | Set Value of trigger. | | `triggerConditions` | [triggerConditions[]](/docs/server-api-ticketing-trigger#trigger-condition-json-format) | body | no | Condition of trigger. | | `agentIds` | array | body | no | The list of agent that the trigger email are sent to. | - #### Response: [Trigger](/docs/server-api-ticketing-trigger#trigger-json-format) - #### Example Sample Request: ``` curl https://api11.comm100.io/v4/ticketing/triggers/18668adf-d440-490a-a049-520a8bd50874 \ -X 'PUT' \ -H 'Authorization: Bearer {access_token}' \ -H 'Content-Type: application/json' \ -D '{"name":"Trigger example","description":"The example of trigger","isEnabled":true,"order":1,"event":"whenTheAssigneeOfATicketHasChanged","status":"new","statusDuration":0,"isValueSettingEnabled":true,"conditionMetType":"all","logicalExpression":"","ifSendEmail":true,"ifSendEmailToContact":true,"ifSendEmailToAgent":true,"ifDisplayInTicketCorrespondences":true,"ifSendEmailToAssignedAgent":true,"triggerActionEmailContent":{"subject":"The example of trigger email","htmlBody":"data:text/plain;base64,PHA+MTExPC9wPg==","textBody":"data:text/plain;base64,MTEx"},"triggerActionUpdateFields":[{"fieldName":"{!Ticket.Status}","value":"resolved"}],"triggerConditions":[{"fieldName":"{!Ticket.Subject}","operator":"contains","value":"example","order":1}]}' ``` Response: HTTP/1.1 200 OK ``` { "id": "18668adf-d440-490a-a049-520a8bd50874", "name": "Trigger example", "description": "The example of trigger", "isEnabled": true, "order": 1, "event": "whenTheAssigneeOfATicketHasChanged", "status": "new", "statusDuration": 0, "isValueSettingEnabled": true, "conditionMetType": "all", "logicalExpression": "", "ifSendEmail": true, "ifSendEmailToContact": true, "ifSendEmailToAgent": true, "ifDisplayInTicketCorrespondences": true, "ifSendEmailToAssignedAgent": true, "triggerConditions": [ { "id": "2c48c435-7c6d-489c-9136-2f92b7b8417f", "triggerId": "18668adf-d440-490a-a049-520a8bd50874", "fieldName": "{!Ticket.Subject}", "operator": "contains", "value": "example", "order": 1 } ], "triggerActionUpdateFields": [ { "id": "ecf38313-fbcc-4d31-b3c5-96f1ec5d1ae0", "triggerId": "18668adf-d440-490a-a049-520a8bd50874", "fieldName": "{!Ticket.Status}", "value": "resolved" } ], "triggerActionEmailContent": { "triggerId": "18668adf-d440-490a-a049-520a8bd50874", "subject": "The example of trigger email", "htmlBody": "data:text/plain;base64,PHA+MTExPC9wPg==", "textBody": "data:text/plain;base64,MTEx" }, "agentIds": [ "1487fc9d-92e6-4487-a2e8-92e68d6892e6" ] } ``` ### Remove the Trigger `DELETE ticketing/triggers/{id}` - #### Parameters: No Parameters - #### Response: No Content - #### Example Sample Request: ``` curl https://api11.comm100.io/v4/ticketing/triggers/18668adf-d440-490a-a049-520a8bd50874 \ -X 'DELETE' \ -H 'Authorization: Bearer {access_token}' \ ``` Response: HTTP/1.1 204 No Content