orkestral / venom

Venom is a high-performance system developed with JavaScript to create a bot for WhatsApp, support for creating any interaction, such as customer service, media sending, sentence recognition based on artificial intelligence and all types of design architecture for WhatsApp.
https://orkestral.io
Apache License 2.0
6.08k stars 1.19k forks source link

Problem With SendFiles, "Error to processFiles" #2535

Closed igormorantos closed 6 months ago

igormorantos commented 11 months ago

In the code below I'm trying to send a PDF, it's giving me the following error

app.post('/send-pdf',[ body('number').notEmpty(), ], async (req, res) => { const errors = validationResult(req).formatWith(({ msg }) => { return msg })

        if(!errors.isEmpty()){
            return res.status(422).json({
                status: false,
                message: errors.mapped()
            });
        }

        const number = req.body.number;
        const path ='./curso.pdf'
        const fileName = 'Curso';
        const description = 'curso auto';

        //client.sendText(number,message);
        client.sendFile(number,path,fileName,description).then(response => {
            res.status(200).json({
                status: true,
                message: 'Mensagem enviada',
                response: response
            });
        }).catch(err => {
            res.status(500).json({
                status: false,
                message: 'Mensagem não enviada',
                response: err.text
            });
        });
        //res.send('Mensagem enviada');
    })  

    ERRO:

    "me": {
        "id": {
            "server": "c.us",
            "user": "557788890834",
            "_serialized": "557788890834@c.us"
        },
        "displayName": null,
        "verifiedName": null,
        "searchName": null,
        "pushname": "Igor",
        "notifyName": null,
        "isBusiness": null,
        "formattedUser": null,
        "tag": "1697060691",
        "eurl": "https://pps.whatsapp.net/v/t61.24694-24/384857814_1377715469846899_8485044292930854182_n.jpg?ccb=11-4&oh=01_AdT3wwl9xqvMsS_lDs-wuzxjh0uuIY4Bndu0dXyrhCBLyA&oe=65651B11&_nc_sid=e6ed6c&_nc_cat=105",
        "previewEurl": "https://pps.whatsapp.net/v/t61.24694-24/384857814_1377715469846899_8485044292930854182_n.jpg?stp=dst-jpg_s96x96&ccb=11-4&oh=01_AdQ2wlC95WTnG1oztzgpqA_3UuuUCFtqLN8RT8h21QuLWQ&oe=65651B11&_nc_sid=e6ed6c&_nc_cat=105",
        "fullDirectPath": "/v/t61.24694-24/384857814_1377715469846899_8485044292930854182_n.jpg?ccb=11-4&oh=01_AdT3wwl9xqvMsS_lDs-wuzxjh0uuIY4Bndu0dXyrhCBLyA&oe=65651B11&_nc_sid=e6ed6c&_nc_cat=105",
        "previewDirectPath": "/v/t61.24694-24/384857814_1377715469846899_8485044292930854182_n.jpg?stp=dst-jpg_s96x96&ccb=11-4&oh=01_AdQ2wlC95WTnG1oztzgpqA_3UuuUCFtqLN8RT8h21QuLWQ&oe=65651B11&_nc_sid=e6ed6c&_nc_cat=105",
        "filehash": "M6RwDPMQ9u1O5XnuoQI2MKNgSYdHqdTkTYfpxH1Zilg=",
        "stale": false,
        "eurlStale": false,
        "timestamp": 1700268717737,
        "hostRetryCount": 0,
        "lastHostUsed": {
            "hostname": "media-for1-1.cdn.whatsapp.net",
            "ips": [
                {
                    "ip4": "157.240.216.60",
                    "ip6": "2a03:2880:f259:c8:face:b00c:0:167"
                }
            ],
            "type": "primary",
            "class": "pop",
            "downloadBuckets": [
                0
            ],
            "_supportedDownloadTypes": {},
            "_supportedUploadTypes": {},
            "fallback": {
                "hostname": "media-gig4-2.cdn.whatsapp.net",
                "ips": [
                    {
                        "ip4": "31.13.91.60",
                        "ip6": "2a03:2880:f27c:1cd:face:b00c:0:167"
                    }
                ],
                "type": "fallback",
                "class": "pop",
                "downloadBuckets": [
                    0
                ],
                "_supportedDownloadTypes": {},
                "_supportedUploadTypes": {},
                "fallback": null
            },
            "selectedBucket": 102
        }
    },
    "to": {
        "server": "c.us",
        "user": "557781107704",
        "_serialized": "5577987625435@c.us"
    },
    "erro": true,
    "text": "Error to processFiles",
    "status": 404
}

}

Error to processFiles, it's a pdf it's working, the file is in this path 'D:portifa/venom/curso.pdf', but for some reason it's not being able to process, and I couldn't find a possible solution anywhere(I've tried to insert the path, in different ways), I was able to send buttons and messages on other routes.

Does anyone know how to solve it?

GrupoRomano commented 11 months ago

Mesmo problema, porém sem entender o real motivo.... Acredito que a API esteja quebrada nessa release

igormorantos commented 10 months ago

la no StackOverFlow me deram essa solução, ainda naõ tive tempo de testar, mas disseram que resolve:

https://github.com/orkestral/venom/issues/2485

orkestral commented 6 months ago

New Release: npm i venom-bot@5.1.0 We have support for Venom for just $15 per month, if you are interested, call our support via the link: https://web.whatsapp.com/send?phone=5561985290357