Trigger
  • 16 Jun 2022
  • 9 Minutes to read
  • Dark
    Light

Trigger

  • Dark
    Light

Article summary

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.

Trigger JSON Format

Trigger is represented as simple flat JSON objects with the following keys:

NameTypeDescription
idguidId of the trigger.
namestringName of the trigger.
descriptionstringDescription of the trigger.
isEnabledboolWhether the trigger is enabled or not.
orderintegerOrder of the trigger.
eventstringEvents of the tickets. Allowed values are "whenTicketIsCreated", "whenATicketReplyIsReceived", "WhenAnAgentReplied", "whenTheAssigneeOfATicketHasChanged", "whenTheStatusOfATicketHasChanged", "whenATicketStatusStaysTheSameForASpecifiedPeriodOfTime".
statusstringWhen the status of a ticket match the value, the trigger will work. Allowed values are "new", "pendingInternal", "pendingExternal", "onHold", "resolved".
statusDurationintegerHow long dose a ticket stay at one status.
isValueSettingEnabledboolWhether set value action is enabled or not.
conditionMetTypestringHow conditions are matched. Allowed values are "any", "all", "logicalExpression".
logicalExpressionstringLogical expression to match the conditions i.e., (1 or 2 or 3) and (4 and 5).
ifSendEmailboolWhether to send email or not.
ifSendEmailToContactboolWhether send email to the ticket contact or not.
ifSendEmailToAgentboolWhether sending email to agent or not.
ifDisplayInTicketCorrespondencesboolWith this option enabled, the trigger email will be included within a ticket's correspondence thread.
ifSendEmailToAssignedAgentboolWhether send email to the selected agents or not.
triggerConditionstriggerConditions[]Reference to Trigger Condition.
triggerActionUpdateFieldstriggerActionUpdateFields[]Reference to Trigger Action Update Field.
triggerActionEmailContenttriggerActionEmailContentReference to Trigger Action Email Content.
agentIdsarrayThe list of agent that the trigger email are sent to.

Trigger Action Email Content JSON Format:

NameTypeDescription
triggerIdguidId of the trigger.
subjectstringSubject of the trigger email.
htmlBodystringHTML 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.
textBodystringText 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:

NameTypeDescription
idguidId of the trigger action set value field.
triggerIdguidId of the trigger.
fieldNamestringName of the ticketing field you want to set value for.
valuestringValue of the trigger action field.

Trigger Condition JSON Format:

NameTypeDescription
idguidId of the trigger condition.
triggerIdguidId of the trigger.
fieldNamestringName of the ticketing field you want to set value for.
operatorstringHow value for this condition field is matched. Allowed values are "contains", "notContains", "is", "isNot", "isMoreThan", "isLessThan", "before", "after", "regularExpression", "isOneOf", "isNotIn".
valuestringValue of the condition field.
orderintegerOrder of the trigger condition.

Get the list of Triggers

GET ticketing/triggers

  • Parameters:

NameTypeinRequiredDescription
includestringquerynoAllowed values are "triggerCondition", "triggerActionUpdateField", "agent", "triggerActionEmailContent".
  • Response:

An array of Trigger

  • 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:

NameTypeinRequiredDescription
includestringquerynoAllowed values are "triggerCondition", "triggerActionUpdateField", "agent", "triggerActionEmailContent".
  • Response:

Trigger

  • 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:

NameTypeinRequiredDescription
namestringbodyyesName of the trigger.
descriptionstringbodynoDescription of the trigger.
isEnabledboolbodyyesWhether the trigger is enabled or not.
orderintegerbodynoOrder of the trigger.
eventstringbodyyesEvents of the tickets. Allowed values are "whenTicketIsCreated", "whenATicketReplyIsReceived", "WhenAnAgentReplied", "whenTheAssigneeOfATicketHasChanged", "whenTheStatusOfATicketHasChanged", "whenATicketStatusStaysTheSameForASpecifiedPeriodOfTime".
statusstringbodyyesWhen the status of a ticket match the value, the trigger will work. Allowed values are "new", "pendingInternal", "pendingExternal", "onHold", "resolved".
statusDurationintegerbodynoHow long dose a ticket stay at one status.
isValueSettingEnabledboolbodyyesWhether set value action is enabled or not.
conditionMetTypestringbodyyesHow conditions are matched. Allowed values are "any", "all", "logicalExpression".
logicalExpressionstringbodynoLogical expression to match the conditions i.e., (1 or 2 or 3) and (4 and 5).
ifSendEmailboolbodyyesWhether to send email or not.
ifSendEmailToContactboolbodyyesWhether send email to the ticket contact or not.
ifSendEmailToAgentboolbodyyesWhether sending email to agent or not.
ifDisplayInTicketCorrespondencesboolbodynoWith this option enabled, the trigger email will be included within a ticket's correspondence thread.
ifSendEmailToAssignedAgentboolbodyyesWhether send email to the selected agents or not.
triggerActionEmailContenttriggerActionEmailContentbodynoEmail content of trigger email.
triggerActionUpdateFieldstriggerActionUpdateFields[]bodynoSet Value of trigger.
triggerConditionstriggerConditions[]bodynoCondition of trigger.
agentIdsarraybodynoThe list of agent that the trigger email are sent to.
  • Response:

Trigger

  • 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

  • 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

  • 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:

NameTypeinRequiredDescription
namestringbodyyesName of the trigger.
descriptionstringbodynoDescription of the trigger.
isEnabledboolbodyyesWhether the trigger is enabled or not.
orderintegerbodynoOrder of the trigger.
eventstringbodyyesEvents of the tickets. Allowed values are "whenTicketIsCreated", "whenATicketReplyIsReceived", "WhenAnAgentReplied", "whenTheAssigneeOfATicketHasChanged", "whenTheStatusOfATicketHasChanged", "whenATicketStatusStaysTheSameForASpecifiedPeriodOfTime".
statusstringbodyyesWhen the status of a ticket match the value, the trigger will work. Allowed values are "new", "pendingInternal", "pendingExternal", "onHold", "resolved".
statusDurationintegerbodynoHow long dose a ticket stay at one status.
isValueSettingEnabledboolbodyyesWhether set value action is enabled or not.
conditionMetTypestringbodyyesHow conditions are matched. Allowed values are "any", "all", "logicalExpression".
logicalExpressionstringbodynoLogical expression to match the conditions i.e., (1 or 2 or 3) and (4 and 5).
ifSendEmailboolbodyyesWhether to send email or not.
ifSendEmailToContactboolbodyyesWhether send email to the ticket contact or not.
ifSendEmailToAgentboolbodyyesWhether sending email to agent or not.
ifDisplayInTicketCorrespondencesboolbodynoWith this option enabled, the trigger email will be included within a ticket's correspondence thread.
ifSendEmailToAssignedAgentboolbodyyesWhether send email to the selected agents or not.
triggerActionEmailContenttriggerActionEmailContentbodynoEmail content of trigger email.
triggerActionUpdateFieldstriggerActionUpdateFields[]bodynoSet Value of trigger.
triggerConditionstriggerConditions[]bodynoCondition of trigger.
agentIdsarraybodynoThe list of agent that the trigger email are sent to.
  • Response:

Trigger

  • 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


Was this article helpful?