Giter Club home page Giter Club logo

Comments (8)

KENPRAEL avatar KENPRAEL commented on June 10, 2024

Please try onWhatsapp method for active whatsapp phone number 62816913958

if using WhiskeySockets v6.1.0 always return null array but if using WhiskeySockets v6.0.1 or Adiwajshing lates version working well

from baileys.

aaf-30 avatar aaf-30 commented on June 10, 2024

Taruh @s.whatsapp.net di belakang nomornya.
Seperti ini [email protected]

from baileys.

KENPRAEL avatar KENPRAEL commented on June 10, 2024

Taruh @s.whatsapp.net di belakang nomornya. Seperti ini [email protected]

of course but when checking phone number with short length like sample is not work with latest version v6.1.0 but when using before latest version working correctly

Thank you

from baileys.

lukasportal avatar lukasportal commented on June 10, 2024

i've seen it too... add "+" in the beginning and it works
"+62816913958"

from baileys.

KENPRAEL avatar KENPRAEL commented on June 10, 2024

i've seen it too... add "+" in the beginning and it works "+62816913958"

@lukasportal thank you, it works

from baileys.

salmanrajz avatar salmanrajz commented on June 10, 2024

how to use onWhatsApp, please guide, i'm unable to use it
Thanks

from baileys.

hamidsaifi77 avatar hamidsaifi77 commented on June 10, 2024

i have resolved this by doing this:-

     let result
    ;[result] = await session.onWhatsApp(jid)

            if (typeof result === 'undefined') {
                console.log('checked')
                const getNum = jid.replace("@s.whatsapp.net", "")
                    ;[result] = await session.onWhatsApp(`+${getNum}`)
            }

so your result will be actually true or false value

from baileys.

salmanrajz avatar salmanrajz commented on June 10, 2024

i have resolved this by doing this:-

     let result
    ;[result] = await session.onWhatsApp(jid)

            if (typeof result === 'undefined') {
                console.log('checked')
                const getNum = jid.replace("@s.whatsapp.net", "")
                    ;[result] = await session.onWhatsApp(`+${getNum}`)
            }

so your result will be actually true or false value

export function startExpressJs(sock: { sendMessage: (arg0: string, arg1: any) => Promise; }, store: any) {
const app: Application = express();

app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.text({ type: 'text/html' }));



app.get('/', (req: Request, res: Response) => {
    res.send('Hello World');
});

// SendMsg to USER
app.post('/:userNumber/SendMsgToUser', (req, res) => {
    const sendToClient: { [key: string]: any } = {};
    const chatId: string = req.params.userNumber;
    const chatText: string = Object.keys(req.body)[0];
    let clientId: string = (chatId + '@s.whatsapp.net');
    // sock.onWhatsApp(clientId)
    const id = '123456'
    const salman = 'legacy';
    let result;
    // result.onWhatsApp(clientId);
    // console.log(result);
    const data = result?.onWhatsApp(clientId);

    

   

    // if (session.isLegacy) {
    // const a = res.locals.sessionId;
    // console.log(a);
    // const exists = isExists(salman,clientId);
    // console.log(exists);

    // const status = 'Hello World!'
    // await sock.updateProfileStatus(status)
    // const [result] = Socket.onWhatsApp(id)
    // console.log(makeChatsSocket);
    // if (result.exists) console.log (`${id} exists on WhatsApp, as jid: ${result.jid}`)

    
    const fuckChatText = chatText
        .replace(/\\n/g, "\n")
        .replace(/\\t/g, "\t")
        .replace(/\\r/g, "\r");

    // onWhatsApp
        // console.log(onWhatsApp(clientId))

    sendToClient.error = false;
    sock.sendMessage(clientId, { text: fuckChatText }).then((response: any) => {
        // console.log(response)
        // console.log("Google");
        // if (!response) {
        //         // sendToClient.error = true;
        //         console.log("if");
        //     // sendToClient.error = true;
        //     // console.log("TEST");
        // }
        // else{
        //         sendToClient.error = true;
        //         console.log("else");

        // }
    });
                // sendToClient.error = true;
                // console.log(sock.onWhatsApp(chatId));
                


    
    sendToClient.receiverInfo = {};
    sendToClient.receiverInfo.chatId = chatId;
    sendToClient.receiverInfo.chatIdFormated = clientId;
    sendToClient.receiverInfo.chatText = chatText;
    // console.log(sendToClient);
    res.send(sendToClient);
    // res.onWhatsapp()
});


how can I use this in the above function, any guidelines, please?
Thanks

from baileys.

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.