Telegram If Conditions for Media and Emoji's

Hi
Currently, I am using Telegram Trigger, Telegram Node, HTTP Request + IF Nodes
currently, I am writing an if Condition for certain Texts it works
but I want to add a condition for media and Emoji I try to add it shown error and not working

I want to add like this

If any media or emoji format contains send our Message text

1 Like

Welcome to the community @mskian!

You would have to check how to detect emojis in text but here an example how to detect media and stickers:

{
  "nodes": [
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1,
      "position": [
        450,
        300
      ],
      "webhookId": "10392701-d462-406b-abdc-c20fb1554541",
      "credentials": {
        "telegramApi": ""
      }
    },
    {
      "parameters": {
        "chatId": "={{$json[\"message\"][\"chat\"][\"id\"]}}",
        "text": "=Hi {{$json[\"message\"][\"from\"][\"first_name\"]}}!\nYour message did contain media.",
        "additionalFields": {}
      },
      "name": "Media Found",
      "type": "n8n-nodes-base.telegram",
      "position": [
        850,
        190
      ],
      "typeVersion": 1,
      "credentials": {
        "telegramApi": ""
      }
    },
    {
      "parameters": {
        "chatId": "={{$json[\"message\"][\"chat\"][\"id\"]}}",
        "text": "=Hi {{$json[\"message\"][\"from\"][\"first_name\"]}}!\nYour message did not contain any media.",
        "additionalFields": {}
      },
      "name": "No Media Found",
      "type": "n8n-nodes-base.telegram",
      "position": [
        850,
        400
      ],
      "typeVersion": 1,
      "credentials": {
        "telegramApi": ""
      }
    },
    {
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{!!$json[\"message\"][\"sticker\"]}}",
              "value2": true
            },
            {
              "value1": "={{!!$json[\"message\"][\"photo\"]}}",
              "value2": true
            }
          ]
        },
        "combineOperation": "any"
      },
      "name": "Look for Media",
      "type": "n8n-nodes-base.if",
      "position": [
        650,
        300
      ],
      "typeVersion": 1
    }
  ],
  "connections": {
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Look for Media",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Look for Media": {
      "main": [
        [
          {
            "node": "Media Found",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Media Found",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
1 Like

Perfect
works well

1 Like

Great to hear! Have fun!

1 Like