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

**URL:** <https://discourse.nodered.org/t/how-can-i-send-a-document-with-the-original-document-name/88141>\
**Category:** General\
**Tags:** telegram\
**Created:** [21 May 2024 10:29 UTC](https://discourse.nodered.org/t/how-can-i-send-a-document-with-the-original-document-name/88141 "2024-05-21T10:29:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gadgetooo](https://avatars.discourse-cdn.com/v4/letter/g/8491ac/32.png) [@gadgetooo](https://discourse.nodered.org/u/gadgetooo)\
**Post date:** [21 May 2024 10:29 UTC](https://discourse.nodered.org/t/how-can-i-send-a-document-with-the-original-document-name/88141/1 "2024-05-21T10:29:41Z")

</div>

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:

```auto
[
    {
        "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_

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [19 August 2024 10:30 UTC](https://discourse.nodered.org/t/how-can-i-send-a-document-with-the-original-document-name/88141/2 "2024-08-19T10:30:01Z")

</div>

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