How can I send a document with the original document name?

I have the node-red-contrib-telegrambot 15.1.10. How can I sent a document with the original name of the document? (not "data.pdf" please). I have been trying to write "filename: whathever" in every object but I can't find the solution.

This is an example of what I have been made:

[
    {
        "id": "4e0b634eb29c7e27",
        "type": "telegram sender",
        "z": "e7bbc05a6fb064a4",
        "name": "",
        "bot": "",
        "haserroroutput": false,
        "outputs": 1,
        "x": 1030,
        "y": 1840,
        "wires": [
            [
                "677d05dc998b8cdf"
            ]
        ]
    },
    {
        "id": "677d05dc998b8cdf",
        "type": "debug",
        "z": "e7bbc05a6fb064a4",
        "name": "enviador telegram",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1250,
        "y": 1900,
        "wires": []
    },
    {
        "id": "ab0fc47c5d72df40",
        "type": "file in",
        "z": "e7bbc05a6fb064a4",
        "name": "eyo106",
        "filename": "/home/daniel/Imágenes/111.pdf",
        "filenameType": "str",
        "format": "",
        "chunk": false,
        "sendError": false,
        "encoding": "none",
        "allProps": false,
        "x": 600,
        "y": 1840,
        "wires": [
            [
                "d56ea556b7e859f3"
            ]
        ]
    },
    {
        "id": "d56ea556b7e859f3",
        "type": "function",
        "z": "e7bbc05a6fb064a4",
        "name": "buffer/filename",
        "func": "var filebuffer = msg.payload;\nvar fileName = msg.filename.split('/').pop();\n\nvar payload = {\n    chatId: -XXXXXXXX, // Reemplaza con tu chatId\n    type: \"document\",\n    content: filebuffer,\n    options:{\n        fileName: fileName,\n        contentType: \"application/pdf\"\n    }\n};\nmsg.payload = payload;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 1,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 800,
        "y": 1840,
        "wires": [
            [
                "4e0b634eb29c7e27",
                "bfb6b44f79673786"
            ]
        ]
    },
    {
        "id": "bfb6b44f79673786",
        "type": "debug",
        "z": "e7bbc05a6fb064a4",
        "name": "debug 31",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1000,
        "y": 1900,
        "wires": []
    },
    {
        "id": "b3d85cb2fd8d1c12",
        "type": "inject",
        "z": "e7bbc05a6fb064a4",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 430,
        "y": 1840,
        "wires": [
            [
                "ab0fc47c5d72df40"
            ]
        ]
    }
]

ADMIN EDIT: wrap code in triple backticks

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