{
  "description": "Send incoming messages to Ada",
  "name": "Agent_Message_Flow",
  "steps": [
    {
      "transitions": [
        {
          "target": "user",
          "condition": {
            "op": "true",
            "values": [
              true
            ]
          }
        }
      ],
      "errorCases": [],
      "id": "conversation",
      "action": "kustomer.conversation.find-by-id",
      "params": {
        "id": "/#steps.chat-message.conversation"
      },
      "appVersion": "kustomer-^1.8.5"
    },
    {
      "transitions": [
        {
          "target": "i4Ke_gvDj",
          "condition": {
            "op": "true",
            "values": [
              true
            ]
          }
        }
      ],
      "errorCases": [],
      "id": "user",
      "action": "kustomer.user.find-by-id",
      "params": {
        "id": "/#steps.conversation.assignedUsers"
      },
      "appVersion": "kustomer-^1.8.5"
    },
    {
      "transitions": [
        {
          "target": "HV5dp70qt",
          "condition": {
            "op": "true",
            "values": [
              true
            ]
          }
        }
      ],
      "errorCases": [],
      "id": "i4Ke_gvDj"
    },
    {
      "transitions": [
        {
          "target": "H6mycxgti",
          "condition": {
            "op": "true",
            "values": [
              true
            ]
          }
        }
      ],
      "errorCases": [],
      "id": "HV5dp70qt",
      "action": "kustomer.rest-api.json",
      "params": {
        "method": "GET",
        "uri": "https://api.kustomerapp.com/v1/attachments/{{#each steps.chat-message.attachments}}{{#if this.type true='attachment'}}{{this.id}},{{/if}}{{/each}}",
        "headers": {
          "content-type": "application/json",
          "user-agent": "Ada/Kustomer",
          "Authorization": "Bearer "
        },
        "json": true
      },
      "appVersion": "kustomer-^1.8.5",
      "meta": {
        "displayName": "Rest API: JSON - Fetch Attachment"
      }
    },
    {
      "transitions": [],
      "errorCases": [],
      "id": "H6mycxgti",
      "action": "kustomer.rest-api.json",
      "params": {
        "uri": "https://olympus.svc.ada.support/webhook",
        "method": "POST",
        "data": {
          "id": "/#steps.chat-message.id",
          "name": "kustomer.message.create",
          "data": {
            "message": "/#steps.chat-message",
            "attachments": "/#steps.HV5dp70qt.response.body.data",
            "conversation": "/#steps.conversation",
            "users": {
              "assigned": "/#steps.user"
            }
          }
        },
        "json": true,
        "headers": {
          "content-type": "application/json",
          "user-agent": "Ada/Kustomer"
        }
      },
      "appVersion": "kustomer-^1.8.5",
      "meta": {
        "description": "Rest Api Json",
        "displayName": "Rest API JSON"
      }
    }
  ],
  "trigger": {
    "transitions": [
      {
        "target": "conversation",
        "condition": {
          "op": "true",
          "values": [
            true
          ]
        }
      }
    ],
    "appVersion": "kustomer-^1.8.5",
    "id": "chat-message",
    "eventName": "kustomer.message.create",
    "meta": {
      "description": "Message Create"
    }
  }
}
