How can I create a ready node for data type conversion (string, int, date) and what are the necessary steps to set it up?

Describe the problem/error/question:
I need to process messages from Telegram that may contain different types of data: numbers, strings (words and letters), or dates in the format dd.mm.yyyy. Depending on the data type, the message should be routed to different branches in n8n. For example:

  • If the message contains only numbers, it should go to the branch for processing numbers.
  • If the message contains only letters and words, it should go to the branch for processing strings.
  • If the message contains a date, it should go to the branch for processing dates.

I couldn’t find a built-in solution in n8n for this. Does the community have any ideas or examples of how this can be implemented?

Current n8n setup:

  • n8n version: 1.82.3
  • Database: SQLite (default)
  • Running n8n via Docker on Ubuntu.

Example of incoming messages:
A Telegram message might look like this:

  • 12345 (number)
  • Hello, world! (string)
  • 12.10.2023 (date)

What I’ve tried:
I attempted to use a Function Node to analyze the data type, but I’m wondering if there’s a more efficient way or a ready-made solution.

Question:
Does anyone have an example workflow or ideas on how to implement this kind of data type-based routing?

A switch node using regular expressions could handle this. Here’s an example.

2 Likes

Thanks a lot, it helped a lot, I will test it. And what are some other interesting products but similar to n8n with Make interface. I really like the Make interface well Too bad that it is not an opsensor interface.

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