From 9b4bcd4d097a401cbad80e47a68632062efca427 Mon Sep 17 00:00:00 2001
From: RizaFarheen <rizafarheen@gmail.com>
Date: Fri, 6 Oct 2023 09:35:02 +0400
Subject: [PATCH] Create standup-updates.json

---
 .../workflows/standup-updates.json            | 288 ++++++++++++++++++
 1 file changed, 288 insertions(+)
 create mode 100644 standup-updates/workflows/standup-updates.json

diff --git a/standup-updates/workflows/standup-updates.json b/standup-updates/workflows/standup-updates.json
new file mode 100644
index 0000000..287e7c0
--- /dev/null
+++ b/standup-updates/workflows/standup-updates.json
@@ -0,0 +1,288 @@
+[
+    {
+        "name": "individual_updates",
+        "description": "This workflow is used to get scrum update for user",
+        "version": 2,
+        "tasks": [
+          {
+            "name": "send_welcome_message",
+            "taskReferenceName": "send_welcome_message",
+            "inputParameters": {
+              "user_name": "${workflow.input.user_name}",
+              "http_request": {
+                "uri": "https://slack.com/api/chat.postMessage",
+                "method": "POST",
+                "connectionTimeOut": 3000,
+                "readTimeOut": 3000,
+                "body": {
+                  "channel": "${workflow.input.user_id}",
+                  "text": "Hello *${workflow.input.user_name}*! Good Morning. What is your scrum update for today. Send *done* to end update",
+                  "as_user": true
+                },
+                "headers": {
+                  "Authorization": "Bearer ${workflow.secrets.slack_standup_token}"
+                }
+              }
+            },
+            "type": "HTTP",
+            "decisionCases": {},
+            "defaultCase": [],
+            "forkTasks": [],
+            "startDelay": 0,
+            "joinOn": [],
+            "optional": false,
+            "defaultExclusiveJoinTask": [],
+            "asyncComplete": false,
+            "loopOver": [],
+            "onStateChange": {}
+          },
+          {
+            "name": "loopTask",
+            "taskReferenceName": "loopTask",
+            "inputParameters": {
+              "value": "${workflow.input.loop}"
+            },
+            "type": "DO_WHILE",
+            "decisionCases": {},
+            "defaultCase": [],
+            "forkTasks": [],
+            "startDelay": 0,
+            "joinOn": [],
+            "optional": false,
+            "defaultExclusiveJoinTask": [],
+            "asyncComplete": false,
+            "loopCondition": "if ($.webhook_task['event']['text'] == \"done\" ) { false;} else {true;} ",
+            "loopOver": [
+              {
+                "name": "webhook_task",
+                "taskReferenceName": "webhook_task",
+                "inputParameters": {
+                  "user_id": "${workflow.input.user_id}",
+                  "matches": {
+                    "$['event']['type']": "message",
+                    "$['event']['user']": "${workflow.input.user_id}"
+                  }
+                },
+                "type": "WAIT_FOR_WEBHOOK",
+                "decisionCases": {},
+                "defaultCase": [],
+                "forkTasks": [],
+                "startDelay": 0,
+                "joinOn": [],
+                "optional": false,
+                "defaultExclusiveJoinTask": [],
+                "asyncComplete": false,
+                "loopOver": [],
+                "onStateChange": {}
+              }
+            ],
+            "onStateChange": {}
+          },
+          {
+            "name": "jq_aggregate_updates",
+            "taskReferenceName": "jq_aggregate_updates",
+            "inputParameters": {
+              "updates": "${loopTask.output}",
+              "queryExpression": ".updates | to_entries | .[] | select(.key != \"iteration\") | .value | .webhook_task.event.text | select(. != \"done\") | select (. | startswith(\"Hello\") | not)"
+            },
+            "type": "JSON_JQ_TRANSFORM",
+            "decisionCases": {},
+            "defaultCase": [],
+            "forkTasks": [],
+            "startDelay": 0,
+            "joinOn": [],
+            "optional": false,
+            "defaultExclusiveJoinTask": [],
+            "asyncComplete": false,
+            "loopOver": [],
+            "onStateChange": {}
+          },
+          {
+            "name": "jq_convert_to_string",
+            "taskReferenceName": "jq_convert_to_string",
+            "inputParameters": {
+              "updates": "${jq_aggregate_updates.output.resultList}",
+              "queryExpression": ".updates | join(\",\")"
+            },
+            "type": "JSON_JQ_TRANSFORM",
+            "decisionCases": {},
+            "defaultCase": [],
+            "forkTasks": [],
+            "startDelay": 0,
+            "joinOn": [],
+            "optional": false,
+            "defaultExclusiveJoinTask": [],
+            "asyncComplete": false,
+            "loopOver": [],
+            "onStateChange": {}
+          },
+          {
+            "name": "append_user_name",
+            "taskReferenceName": "append_user_name",
+            "inputParameters": {
+              "user_name": "${workflow.input.user_name}",
+              "updates": "${jq_convert_to_string.output}",
+              "queryExpression": "(.user_name + \"'s update - \" + .updates.result)"
+            },
+            "type": "JSON_JQ_TRANSFORM",
+            "decisionCases": {},
+            "defaultCase": [],
+            "forkTasks": [],
+            "startDelay": 0,
+            "joinOn": [],
+            "optional": false,
+            "defaultExclusiveJoinTask": [],
+            "asyncComplete": false,
+            "loopOver": [],
+            "onStateChange": {}
+          },
+          {
+            "name": "post_updates",
+            "taskReferenceName": "post_updates",
+            "inputParameters": {
+              "http_request": {
+                "uri": "${workflow.secrets.slack_conductor_channel_url}",
+                "method": "POST",
+                "connectionTimeOut": 3000,
+                "readTimeOut": 3000,
+                "body": {
+                  "text": "${append_user_name.output.result}"
+                },
+                "headers": {
+                  "Content-type": "application/json"
+                }
+              }
+            },
+            "type": "HTTP",
+            "decisionCases": {},
+            "defaultCase": [],
+            "forkTasks": [],
+            "startDelay": 0,
+            "joinOn": [],
+            "optional": false,
+            "defaultExclusiveJoinTask": [],
+            "asyncComplete": false,
+            "loopOver": [],
+            "onStateChange": {}
+          }
+        ],
+        "inputParameters": [
+          "user_name",
+          "user_id"
+        ],
+        "outputParameters": {},
+        "schemaVersion": 2,
+        "restartable": true,
+        "workflowStatusListenerEnabled": false,
+        "ownerEmail": "viren@orkes.io",
+        "timeoutPolicy": "TIME_OUT_WF",
+        "timeoutSeconds": 1800,
+        "variables": {},
+        "inputTemplate": {},
+        "onStateChange": {}
+      },
+      {
+        "name": "standup_updates_main",
+        "description": "standup_updates_main",
+        "version": 1,
+        "tasks": [
+          {
+            "name": "fork",
+            "taskReferenceName": "fork",
+            "inputParameters": {},
+            "type": "FORK_JOIN",
+            "decisionCases": {},
+            "defaultCase": [],
+            "forkTasks": [
+              [
+                {
+                  "name": "riza_updates",
+                  "taskReferenceName": "riza_updates",
+                  "inputParameters": {
+                    "user_name": "Riza",
+                    "user_id": "xxxxxxxxxxx"
+                  },
+                  "type": "SUB_WORKFLOW",
+                  "decisionCases": {},
+                  "defaultCase": [],
+                  "forkTasks": [],
+                  "startDelay": 0,
+                  "subWorkflowParam": {
+                    "name": "individual_updates",
+                    "version": 2
+                  },
+                  "joinOn": [],
+                  "optional": true,
+                  "defaultExclusiveJoinTask": [],
+                  "asyncComplete": false,
+                  "loopOver": [],
+                  "retryCount": 0,
+                  "onStateChange": {}
+                }
+              ],
+              [
+                {
+                  "name": "isabellas_update",
+                  "taskReferenceName": "isabellas_update",
+                  "inputParameters": {
+                    "user_name": "Isabella",
+                    "user_id": "XXXXXXXXXXX"
+                  },
+                  "type": "SUB_WORKFLOW",
+                  "decisionCases": {},
+                  "defaultCase": [],
+                  "forkTasks": [],
+                  "startDelay": 0,
+                  "subWorkflowParam": {
+                    "name": "individual_updates"
+                  },
+                  "joinOn": [],
+                  "optional": true,
+                  "defaultExclusiveJoinTask": [],
+                  "asyncComplete": false,
+                  "loopOver": [],
+                  "onStateChange": {}
+                }
+              ]
+            ],
+            "startDelay": 0,
+            "joinOn": [],
+            "optional": false,
+            "defaultExclusiveJoinTask": [],
+            "asyncComplete": false,
+            "loopOver": [],
+            "onStateChange": {}
+          },
+          {
+            "name": "join",
+            "taskReferenceName": "join",
+            "inputParameters": {},
+            "type": "JOIN",
+            "decisionCases": {},
+            "defaultCase": [],
+            "forkTasks": [],
+            "startDelay": 0,
+            "joinOn": [
+              "isabellas_update",
+              "riza_updates"
+            ],
+            "optional": false,
+            "defaultExclusiveJoinTask": [],
+            "asyncComplete": false,
+            "loopOver": [],
+            "onStateChange": {}
+          }
+        ],
+        "inputParameters": [],
+        "outputParameters": {},
+        "schemaVersion": 2,
+        "restartable": true,
+        "workflowStatusListenerEnabled": false,
+        "ownerEmail": "viren@orkes.io",
+        "timeoutPolicy": "ALERT_ONLY",
+        "timeoutSeconds": 0,
+        "variables": {},
+        "inputTemplate": {},
+        "onStateChange": {}
+      }
+]
\ No newline at end of file