Comments (8)
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.
Taruh @s.whatsapp.net
di belakang nomornya.
Seperti ini [email protected]
from baileys.
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.
i've seen it too... add "+" in the beginning and it works
"+62816913958"
from baileys.
i've seen it too... add "+" in the beginning and it works "+62816913958"
@lukasportal thank you, it works
from baileys.
how to use onWhatsApp, please guide, i'm unable to use it
Thanks
from baileys.
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.
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)
- Emoji Reaction HOT 3
- [BUG] How fix Connection Terminate? HOT 1
- Is there a way to access whatsapp channel?
- [BUG] How to send an event invitation message in a group with the community
- [BUG] SCHEDULE CALL -> WAITING MESSAGE
- [BUG] unable to get message.update event from poll vote HOT 1
- [BUG] Baileys
- [BUG] Looping in message.upsert HOT 2
- Send Media Message Memory Leak HOT 1
- [BUG] makeInMemoryStore HOT 2
- [BUG]
- [BUG]
- [BUG] HOT 3
- [BUG] HOT 3
- Request Adding Charge Buyer for WhatsApp Bussiness HOT 1
- [BUG] Broadcast option is not present in the message options
- [BUG] HOT 1
- [BUG] Stream errored out after QR scan HOT 3
- [BUG] HOT 2
- [BUG] Error playing audio on iOS/WA (Windows) devices
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from baileys.