{
  "name": "kanboard workflow",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "b7a7ef6e-f665-453d-92ae-b6b99bfe31a6",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -3100,
        -3860
      ],
      "id": "7be3039c-ba29-487d-abe0-5c788b87138c",
      "name": "Webhook",
      "webhookId": "b7a7ef6e-f665-453d-92ae-b6b99bfe31a6"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $('Webhook').item.json.body.event_name }}",
                    "rightValue": "task.create",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "7bd3c0d0-cc88-4426-998b-3f82975ec71e"
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "8a3dda3c-8c68-4d22-8574-becb34392016",
                    "leftValue": "={{ $('Webhook').item.json.body.event_name }}",
                    "rightValue": "task.close",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "f347e3aa-2173-436e-8a68-91bf7099338c",
                    "leftValue": "={{ $('Webhook').item.json.body.event_name }}",
                    "rightValue": "task.assignee_change",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "28522371-dd69-4475-a38c-4b4fb752d374",
                    "leftValue": "={{ $('Webhook').item.json.body.event_name }}",
                    "rightValue": "task.update",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        -2640,
        -3820
      ],
      "id": "579f446b-e171-4fa5-a874-10c6a9695e95",
      "name": "Switch"
    },
    {
      "parameters": {
        "channelId": "=m9f6nq8fs7ri9qx7yr96pw7rqa",
        "message": "**Nouvelle notification : Tâche créée**",
        "attachments": [
          {
            "text": "=**Nom de la tâche** : {{ $json.body.event_data.task.title }}\n**Date de création** : {{ new Date($json.body.event_data.task.date_creation * 1000).toLocaleDateString('fr-FR') }} \n**Nom du projet** : {{ $json.body.event_data.task.project_name }}\n**Créateur** : {{ $json.body.event_data.task.creator_username }}\n**Délai de la tâche** : {{ new Date( $json.body.event_data.task.date_due * 1000).toLocaleDateString('fr-FR') }}\n**Assigné à** : @{{ $json.body.event_data.task.assignee_username }}\n**Action faite** : {{ $json.body.event_author }}"
          }
        ],
        "otherOptions": {}
      },
      "type": "n8n-nodes-base.mattermost",
      "typeVersion": 1,
      "position": [
        -2360,
        -4160
      ],
      "id": "dd7bda90-e741-4699-92b5-4c97b2f08981",
      "name": "Creation tache",
      "credentials": {
        "mattermostApi": {
          "id": "gwmEud3diqx6IrC0",
          "name": "n8n_bot"
        }
      }
    },
    {
      "parameters": {
        "channelId": "=m9f6nq8fs7ri9qx7yr96pw7rqa",
        "message": "Nouvelle notification : Tâche fermée",
        "attachments": [
          {
            "text": "=Nom de la tâche : {{ $json.body.event_data.task.title }}\nDate de création : {{ new Date($json.body.event_data.task.date_creation * 1000).toLocaleDateString('fr-FR') }} \nNom du projet : {{ $json.body.event_data.task.project_name }}\nCréateur : {{ $json.body.event_data.task.creator_username }}\nDélai de la tâche : {{ new Date( $json.body.event_data.task.date_due * 1000).toLocaleDateString('fr-FR') }}\nAssigné à : {{ $json.body.event_data.task.assignee_username }}\nAction faite : {{ $json.body.event_author }}"
          }
        ],
        "otherOptions": {}
      },
      "type": "n8n-nodes-base.mattermost",
      "typeVersion": 1,
      "position": [
        -2360,
        -3980
      ],
      "id": "3eb69f6e-4fd6-443d-ada5-44e804f3620d",
      "name": "Fermeture tache",
      "credentials": {
        "mattermostApi": {
          "id": "gwmEud3diqx6IrC0",
          "name": "n8n_bot"
        }
      }
    },
    {
      "parameters": {
        "channelId": "=m9f6nq8fs7ri9qx7yr96pw7rqa",
        "message": "=Nouvelle notification : Tâche assignée à @{{ $json.body.event_data.task.assignee_username }}",
        "attachments": [
          {
            "text": "=Nom de la tâche : {{ $json.body.event_data.task.title }}\nDate de création : {{ new Date($json.body.event_data.task.date_creation * 1000).toLocaleDateString('fr-FR') }} \nNom du projet : {{ $json.body.event_data.task.project_name }}\nCréateur : {{ $json.body.event_data.task.creator_username }}\nDélai de la tâche : {{ new Date( $json.body.event_data.task.date_due * 1000).toLocaleDateString('fr-FR') }}\nAssigné à : @{{ $json.body.event_data.task.assignee_username }}\nAction faite : {{ $json.body.event_author }}"
          }
        ],
        "otherOptions": {}
      },
      "type": "n8n-nodes-base.mattermost",
      "typeVersion": 1,
      "position": [
        -2380,
        -3760
      ],
      "id": "a8f6b4f6-1e8b-473c-ae68-bd81bc743ed9",
      "name": "Assignation tache",
      "credentials": {
        "mattermostApi": {
          "id": "gwmEud3diqx6IrC0",
          "name": "n8n_bot"
        }
      }
    },
    {
      "parameters": {
        "channelId": "=m9f6nq8fs7ri9qx7yr96pw7rqa",
        "message": "Nouvelle notification : Tâche mise à jour",
        "attachments": [
          {
            "text": "=Nom de la tâche : {{ $json.body.event_data.task.title }}\nDate de création : {{ new Date($json.body.event_data.task.date_creation * 1000).toLocaleDateString('fr-FR') }} \nNom du projet : {{ $json.body.event_data.task.project_name }}\nCréateur : {{ $json.body.event_data.task.creator_username }}\nDélai de la tâche : {{ new Date( $json.body.event_data.task.date_due * 1000).toLocaleDateString('fr-FR') }}\nAssigné à : @{{ $json.body.event_data.task.assignee_username }}\nAction faite : {{ $json.body.event_author }}"
          }
        ],
        "otherOptions": {}
      },
      "type": "n8n-nodes-base.mattermost",
      "typeVersion": 1,
      "position": [
        -2360,
        -3560
      ],
      "id": "8ec50e95-c975-4d77-b334-15f81a844424",
      "name": "MAJ tache",
      "credentials": {
        "mattermostApi": {
          "id": "gwmEud3diqx6IrC0",
          "name": "n8n_bot"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "da456010-ef0c-472a-bfe7-fbad776875bf",
              "leftValue": "={{ $('Webhook').item.json.body.event_data.task.assignee_username }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -2160,
        -3760
      ],
      "id": "97123b28-4e2a-4bd8-b5b8-5f9628321757",
      "name": "If"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "4f6baea5-30e4-459f-9d22-405c4ca363cf",
              "leftValue": "={{ $json.body.event_data.task.project_name }}",
              "rightValue": "n8n_project_test",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -2900,
        -3740
      ],
      "id": "b804d297-2ddb-44ed-a9b3-3a7d88c803ce",
      "name": "If1"
    },
    {
      "parameters": {
        "resource": "channel",
        "operation": "addUser",
        "channelId": "=",
        "userId": "3uit7rd6iifj7fxawiytw4pu5h"
      },
      "type": "n8n-nodes-base.mattermost",
      "typeVersion": 1,
      "position": [
        -2140,
        -4160
      ],
      "id": "3dd4e0a5-15a1-42de-acca-b2fd6c1d6036",
      "name": "Mattermost",
      "credentials": {
        "mattermostApi": {
          "id": "gwmEud3diqx6IrC0",
          "name": "n8n_bot"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Creation tache",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Fermeture tache",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Assignation tache",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "MAJ tache",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Assignation tache": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "MAJ tache": {
      "main": [
        []
      ]
    },
    "Creation tache": {
      "main": [
        [
          {
            "node": "Mattermost",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        []
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "timezone": "Africa/Porto-Novo",
    "callerPolicy": "workflowsFromSameOwner"
  },
  "versionId": "41418eee-4b17-4b71-af11-65dd05d015cc",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "50cab9d6876720658d4e0d0a26972c05eda99ec85b486fe094c33bab381f9fd5"
  },
  "id": "au8tsZ3F4Ahr1TAW",
  "tags": []
}