GithubHelp home page GithubHelp logo

Send video about wa-automate-nodejs HOT 5 CLOSED

open-wa avatar open-wa commented on July 21, 2024
Send video

from wa-automate-nodejs.

Comments (5)

uargb avatar uargb commented on July 21, 2024

@smashah any comment)?

from wa-automate-nodejs.

smashah avatar smashah commented on July 21, 2024

hey @uargb Can you share the code that you're using?

The index.ts in the demo literally reads a file, saves it and sends it back to the number that sent the file so it should work fine.

from wa-automate-nodejs.

Marcoserious avatar Marcoserious commented on July 21, 2024

Hello, I want to send a video (aaa.mp4) that is in the same folder of the server.js file and what am I doing wrong? help please...

// import { create, Whatsapp } from 'sulla-hotfix';
const sulla = require('sulla-hotfix');

sulla.create().then(client => start(client));

var fs = require('fs');

// function to encode file data to base64 encoded string
function base64_encode(file) {
// read binary data
var bitmap = fs.readFileSync(file);
// convert binary data to base64 encoded string
return new Buffer(bitmap).toString('base64');
}
a=base64_encode("aaa.mp4");
var base64str = 'data:video/mp4'+";base64,"+a.toString('base64')
console.log(base64str)
function start(client) {
client.onMessage(async message => {

if (message.body === 'Hi') {

  client.sendText(message.from, '👋 Hello from sulla!');
  await client.sendFile(message.from,[base64str],'aaa.mp4', `Hello this is the caption`)
  console.log()

   //client.sendText(message.from, '👋 Hello from sulla!');
}

/*
console.log(message)
console.log("................................................................................")
console.log(message.mimetype)
console.log("...............................................................")
const mediaData = decryptMedia(message);
console.log(mediaData)
*/
});
}

from wa-automate-nodejs.

smashah avatar smashah commented on July 21, 2024

@Marcoserious why are there square brackets around base64str?

from wa-automate-nodejs.

smashah avatar smashah commented on July 21, 2024

I'm closing this issue for now. Please keep me updated if there are some more issues.

from wa-automate-nodejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.