{
  "name": "Create smenso Task from Webhook and notify Microsoft Teams",
  "tags": [],
  "nodes": [
    {
      "id": "31eb5384-d23a-49ae-9f8d-f2ffd493f3d3",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        160,
        208
      ],
      "parameters": {
        "path": "smenso-task",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "7574e620-4d96-4bc7-8a27-5212f1d39230",
      "name": "Prepare Fields",
      "type": "n8n-nodes-base.set",
      "notes": "Map incoming webhook fields to smenso task fields.\nReplace YOUR_PROJECT_ID_HERE with your smenso Project ID.",
      "position": [
        384,
        208
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "field1",
              "name": "title",
              "type": "string",
              "value": "={{ $json.body.title ?? $json.body.subject ?? 'New Task from Webhook' }}"
            },
            {
              "id": "field2",
              "name": "description",
              "type": "string",
              "value": "={{ $json.body.description ?? $json.body.message ?? '' }}"
            },
            {
              "id": "field3",
              "name": "projectId",
              "type": "string",
              "value": "={{ $json.body.projectId ?? 'YOUR_PROJECT_ID_HERE' }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "bcabffe5-3be3-41ba-b987-cc1498c6d6d1",
      "name": "smenso",
      "type": "n8n-nodes-smenso.smenso",
      "position": [
        608,
        208
      ],
      "parameters": {
        "title": "={{ $json.title }}",
        "resource": "task",
        "operation": "create",
        "projectId": "={{ $json.projectId }}",
        "additionalFields": {
          "description": "={{ $json.description }}"
        }
      },
      "credentials": {
        "smensoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1f1a0297-f2ba-4fc1-a80e-6e188b039628",
      "name": "Notify Teams",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "Replace YOUR_TEAMS_WEBHOOK_URL_HERE with your Microsoft Teams Incoming Webhook URL.\nCreate one in Teams: Channel \u2192 Manage channel \u2192 Connectors \u2192 Incoming Webhook",
      "position": [
        832,
        208
      ],
      "parameters": {
        "url": "YOUR_TEAMS_WEBHOOK_URL_HERE",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"type\": \"message\",\n  \"attachments\": [{\n    \"contentType\": \"application/vnd.microsoft.card.adaptive\",\n    \"content\": {\n      \"type\": \"AdaptiveCard\",\n      \"version\": \"1.4\",\n      \"body\": [\n        {\n          \"type\": \"TextBlock\",\n          \"text\": \"\u2705 New smenso Task created\",\n          \"weight\": \"Bolder\",\n          \"size\": \"Large\"\n        },\n        {\n          \"type\": \"TextBlock\",\n          \"text\": \"{{ $('Prepare Fields').item.json.title }}\",\n          \"wrap\": true\n        },\n        {\n          \"type\": \"TextBlock\",\n          \"text\": \"{{ $('Prepare Fields').item.json.description }}\",\n          \"wrap\": true,\n          \"isSubtle\": true\n        }\n      ]\n    }\n  }]\n}",
        "sendBody": true,
        "specifyBody": "json"
      },
      "typeVersion": 4.4
    },
    {
      "id": "b8052a77-ca1d-465b-9b48-dbadff74f53a",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1056,
        208
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={ \"success\": true, \"message\": \"Task created successfully\" }"
      },
      "typeVersion": 1.1
    },
    {
      "id": "a9c7c79f-8989-48e1-b4a1-ff5ae7bb32bf",
      "name": "README",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        420
      ],
      "parameters": {
        "color": 6,
        "width": 640,
        "height": 380,
        "content": "## \ud83d\udccb Create smenso Task from Webhook and notify Microsoft Teams\n\n**What this workflow does:**\nReceives data from any webhook (form, app, API) and automatically creates a task in smenso. The team gets notified instantly in Microsoft Teams via an Adaptive Card.\n\n**Setup:**\n1. Set your **smenso API** credentials\n2. Replace `YOUR_PROJECT_ID_HERE` in **Prepare Fields** with your smenso Project ID\n3. Replace `YOUR_TEAMS_WEBHOOK_URL_HERE` in **Notify Teams** with your Teams Incoming Webhook URL\n\n**Find your Project ID:**\nAdd a smenso node \u2192 Resource: Project \u2192 Operation: Get Many \u2192 Execute \u2192 copy the `id` field.\n\n**Create a Teams Incoming Webhook:**\nTeams \u2192 Channel \u2192 Manage channel \u2192 Connectors \u2192 Incoming Webhook \u2192 Configure\n\n**Webhook payload:**\n```json\n{\n  \"title\": \"My Task Title\",\n  \"description\": \"Task description\",\n  \"projectId\": \"your-project-id\"\n}\n```"
      },
      "typeVersion": 1
    }
  ],
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1",
  "staticData": null,
  "connections": {
    "smenso": {
      "main": [
        [
          {
            "node": "Notify Teams",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Prepare Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify Teams": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Fields": {
      "main": [
        [
          {
            "node": "smenso",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "triggerCount": 0
}