Handle telephone number for Monday.com

Describe the problem/error/question

Hi, I’m new to N8N. I have a contact form on my website which sends data via webhook to N8N and forwards the data to Monday.com. I have an issue with the telephone number field if someone enters letters instead of a telephone number.

I have this in the “column values” field:

{
    "lead_email": {
        "email": "{{ $('Webhook').item.json.body.email }}",
        "text": "{{ $('Webhook').item.json.body.email }}"
    },
    "lead_company": "{{ $('Webhook').item.json.body.firma }}",
    "lead_phone": {
        "phone": "{{ $('Webhook').item.json.body.telefon }}",
        "countryShortName": "DE"
    },
    "text__1": "{{ $('Webhook').item.json.body.__refer }}",
    "text8__1": "{{ $('Webhook').item.json.body.ihre_nachricht }}"
}

How can I handle the telephone number correctly? If someone types “abc 123” into the telephone field I have an error. If I type only numbers everything works. Do you have suggestions?

What is the error message (if any)?

TypeError: Cannot read properties of undefined (reading 'create_item') at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/MondayCom/MondayCom.node.js:510:58) at processTicksAndRejections (node:internal/process/task_queues:95:5) at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:728:19) at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:660:53 at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1062:20

Please share your workflow

{
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "1abfd07588bc6d03a34b151b0aac1bb6a89bcffb66ff17523577a5846325390b"
  },
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "779aada2-e544-4ff6-8dd5-a980b7005f25",
        "options": {}
      },
      "id": "42098a5a-ac53-4e0b-a0f5-505008a37532",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        880,
        360
      ],
      "webhookId": "779aada2-e544-4ff6-8dd5-a980b7005f25"
    }
  ],
  "connections": {},
  "pinData": {
    "Webhook": [
      {
        "headers": {
          "connection": "close",
          "host": "censored",
          "x-forwarded-scheme": "https",
          "x-forwarded-proto": "https",
          "x-forwarded-for": "85.13.135.234",
          "x-real-ip": "85.13.135.234",
          "content-length": "300",
          "user-agent": "WordPress/6.5.2; censored",
          "accept": "*/*",
          "accept-encoding": "deflate, gzip, br, zstd",
          "content-type": "application/x-www-form-urlencoded"
        },
        "params": {},
        "query": {},
        "body": {
          "vorname": "Test",
          "nachname": "Test",
          "firma": "DeineMutterGmbH",
          "email": "[email protected]",
          "telefon": "abc 123",
          "dienstleistungen[0]": "Webdesign",
          "dienstleistungen[1]": "SEO",
          "ihre_nachricht": "<p>gfwegerhgerhg</p>",
          "dsgvo": "gdpr_accepted",
          "__form_id": "6037",
          "__refer": "https://example.org/monday-com-test/",
          "__is_ajax": "0"
        },
        "webhookUrl": "https://example.org/webhook-test/779aada2-e544-4ff6-8dd5-a980b7005f25",
        "executionMode": "test"
      }
    ]
  }
}

{
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "1abfd07588bc6d03a34b151b0aac1bb6a89bcffb66ff17523577a5846325390b"
  },
  "nodes": [
    {
      "parameters": {
        "channelId": "censored",
        "message": "=### Formular wurde abgesendet:\nRefer:  {{ $json.body.__refer }}\nVorname: {{ $json.body.vorname }}\nNachname: {{ $json.body.nachname }}\nFirma: {{ $json.body.firma }}\nE-Mail: {{ $json.body.email }}\nTelefon: {{ $json.body.telefon }}\nNachricht:\n{{ $json.body.ihre_nachricht }}\n\nGewählte Dienstleistungen:\nTODO\n\n---\nWeiterleitung an Monday...",
        "attachments": [],
        "otherOptions": {}
      },
      "id": "8f81a186-f23f-4288-9d0e-b16c9e769fb9",
      "name": "Mattermost",
      "type": "n8n-nodes-base.mattermost",
      "typeVersion": 1,
      "position": [
        1100,
        360
      ],
      "credentials": {
        "mattermostApi": {
          "id": "censored",
          "name": "Mattermost account"
        }
      }
    }
  ],
  "connections": {},
  "pinData": {}
}


{
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "1abfd07588bc6d03a34b151b0aac1bb6a89bcffb66ff17523577a5846325390b"
  },
  "nodes": [
    {
      "parameters": {
        "resource": "boardItem",
        "boardId": "3890260878",
        "groupId": "emailed_elemente",
        "name": "={{ $('Webhook').item.json.body.vorname }}  {{ $('Webhook').item.json.body.nachname }}",
        "additionalFields": {
          "columnValues": "={\n    \"lead_email\": {\n        \"email\": \"{{ $('Webhook').item.json.body.email }}\",\n        \"text\": \"{{ $('Webhook').item.json.body.email }}\"\n    },\n    \"lead_company\": \"{{ $('Webhook').item.json.body.firma }}\",\n    \"lead_phone\": {\n        \"phone\": \"{{ $('Webhook').item.json.body.telefon }}\",\n        \"countryShortName\": \"DE\"\n    },\n    \"text__1\": \"{{ $('Webhook').item.json.body.__refer }}\",\n    \"text8__1\": \"{{ $('Webhook').item.json.body.ihre_nachricht }}\"\n}"
        }
      },
      "id": "145de9d6-da0a-4cab-85c8-b934d15fdfe0",
      "name": "Monday.com",
      "type": "n8n-nodes-base.mondayCom",
      "typeVersion": 1,
      "position": [
        1320,
        360
      ],
      "credentials": {
        "mondayComApi": {
          "id": "censored",
          "name": "Monday.com account"
        }
      }
    }
  ],
  "connections": {},
  "pinData": {}
}

Share the output returned by the last node

See above. I except if someone types a mix of letters and numbers only numbers are sent to Monday. Maybe someone types “My office number: 123” then only “123” should be used for further execution.

Information on your n8n setup

  • n8n version: 1.38.1
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system:

@kanka.dev , if the telephone number is in that shape, it probably contains no valid number in the first place and you could simply leave it blank. However, if you want to extract only the digits you could remove non-digital characters with the expression {{ $json.body.telefon.replace(/\D/g, "") }}.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.