ZIS Bundle: Adding a Choice state

The following bundle extends the example in Anatomy of a ZIS Bundle by adding a second flow and JobSpec, which responds to a Ticket Status Change event. It also implements a choice state to add conditional branching to a flow.

{  "zis_template_version": "2019-10-14",  "name": "Simple Zendesk-Slack integration",  "description": "React to Ticket events in ZIS with a Slack message",  "resources": {    "slack.post_message_action": {      "type": "ZIS::Action::Http",      "properties": {        "name": "slack.post_simple_message",        "definition": {          "method": "POST",          "url.$": "https://hooks.slack.com/services/{{$.path}}",          "requestBody": {            "text.$": "$.slack_message"          }        }      }    },    "react_to_ticket_commentadded_flow": {      "type": "ZIS::Flow",      "properties": {        "name": "react_to_ticket_commentadded_flow",        "definition": {          "StartAt": "PostCommentAddedMessageToSlack",          "States": {            "PostCommentAddedMessageToSlack": {              "Type": "Action",              "ActionName": "zis:<YOUR_INTEGRATION>:action:slack.post_simple_message",              "Parameters": {                "path": "<YOUR_SLACK_TOKEN>",                "slack_message.$": "A new comment: {{$.input.ticket_event.comment.body}}"              },              "End": true            }          }        }      }    },    "react_to_ticket_statuschanged_flow": {      "type": "ZIS::Flow",      "properties": {        "name": "react_to_ticket_statuschanged_flow",        "definition": {          "StartAt": "CheckTicketStatus",          "States": {            "CheckTicketStatus": {              "Type": "Choice",              "Choices": [                {                  "Variable": "$.input.ticket_event.current",                  "StringEquals": "solved",                  "Next": "PostStatusSolvedMessageToSlack"                }              ],              "Default": "StatusNotSolved"            },            "PostStatusSolvedMessageToSlack": {              "Type": "Action",              "ActionName": "zis:<YOUR_INTEGRATION>:action:slack.post_simple_message",              "Parameters": {                "path": "<YOUR_SLACK_TOKEN>",                "slack_message": "High five team, another customer issue solved!"              },              "End": true            },            "StatusNotSolved": {              "Type": "Succeed",              "Message": "Nothing to see here.  Status has changed but has not become Solved."            }          }        }      }    },    "react_to_ticket_commentadded_job_spec": {      "type": "ZIS::JobSpec",      "properties": {        "name": "react_to_ticket_commentadded_job_spec",        "event_source": "support",        "event_type": "ticket.CommentAdded",        "flow_name": "zis:<YOUR_INTEGRATION>:flow:react_to_ticket_commentadded_flow"      }    },    "react_to_ticket_statuschanged_job_spec": {      "type": "ZIS::JobSpec",      "properties": {        "name": "react_to_ticket_statuschanged_job_spec",        "event_source": "support",        "event_type": "ticket.StatusChanged",        "flow_name": "zis:<YOUR_INTEGRATION>:flow:react_to_ticket_statuschanged_flow"      }    }  }}

Replace the following placeholders with your own values:

  • <YOUR_INTEGRATION> with the name of your integration
  • <YOUR_SLACK_TOKEN> should be replaced with the token portion of a Slack webhook URL https://hooks.slack.com/services/<YOUR_SLACK_TOKEN>.