Comments (25)
I'm trying to find another solution. If i found, i will post here
from sulla.
Does your ${num}
include country code?
from sulla.
@vasani-arpit yes it does
from sulla.
Any result on it?
from sulla.
@andretasty Nope, still having the problem
from sulla.
Just tested it. Works fine. Are you sure your receiver is a registered WA user?
from sulla.
@vasani-arpit yes I just tried it again and it didn't work. The receiver is registered in WhatsApp and it is also shown on 'select contact' section that the number is valid. However, I didn't use the WAPI class. How do I use it, it might make a difference.
from sulla.
I cant send. a tried many numbers, but without success
from sulla.
@amajai did you tested with WAPI class?
from sulla.
@andretasty I don't know how to use it. Was hoping for @vansani-arpit to explain how
from sulla.
As you know the underlying library which us being used is wapi.js (which I use in my wbot repo as well). I am yet to explore TypeScript so I prefer same old JS debugging.
In which I'd run web.whatsapp in normal chrome and inject wapi.js using snippet in DevTools. Once it is injected I can use the functions it provides like wapi.sendMessage2 which is being used by this library but via TypeScript.
Now, you can do all this programmatically, that's what exactly sulla does.
from sulla.
When i try to send a message to new chat, and give a console.log on sendText, node give me this line: Promise { }. What is this?
from sulla.
It is returning a promise. You need to add .then()
and .catch()
to get the result when it completes. for more you can check https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
from sulla.
is that the problem? Every time that i need to send a message, before i need to open a chat to the contact receive. here is my actual code
// import { create, Whatsapp } from 'sulla';
const sulla = require('sulla');
const express = require('express');
const app = express();
sulla.create().then(client => start(client));
function start(client) {
app.get("/:numero/:msg/", function(req, res){
client.sendText(req.params.numero + '@c.us',req.params.msg);
res.sendFile(__dirname + '/html/index.html');
})
}
app.listen(8090, function(){
console.log("servidor rodando");
});
from sulla.
Keep express aside for the testing purpose and try this
const sulla = require('sulla');
const numero = '12345678900'
sulla.create().then(client => start(client));
function start(client) {
client.sendText(numero+'@c.us', '👋 Hello from sulla!');
}
If this works then you can think about adding express. If it doesn't then there is something wrong with sulla.
from sulla.
Still doesn't work :/. Sulla only sends message when the contact is in chat tab
from sulla.
There could be something wrong with sulla. You can use original one or modify wbot
from sulla.
On second thought. If you can change this line to sendMessage2
then it could work.
from sulla.
Interesting solution. Will try changing the line first. If it doesn't work out, I'll try the wbot since I'm struggling to make the original work for me.
from sulla.
When i inject wapi.js on web.whatsapp, i get false response when the chat isn't started.
from sulla.
@vasani-arpit Unfortunately, changing it to sendMessage2
didn't make a difference. I'm guessing same will happen with wbot since the underlying library is wapi.js. Oh well, looks like its not possible after all. Thanks for the help though.
from sulla.
@andretasty Much appreciated you can. I'll do the same as well.
from sulla.
found any solutions?
from sulla.
Keep express aside for the testing purpose and try this
const sulla = require('sulla'); const numero = '12345678900' sulla.create().then(client => start(client)); function start(client) { client.sendText(numero+'@c.us', '👋 Hello from sulla!'); }If this works then you can think about adding express. If it doesn't then there is something wrong with sulla.
Did any one find solution for this? I am getting ReferenceError: WAPI is not defined error message.
from sulla.
Plase update to new version
To send a message to a contact (non-group) just type the number
client.sendText('[email protected]', 'Direct message');
On a regular message received do a console.log(message)
to and check the from
property
from sulla.
Related Issues (20)
- How to manage and send message to diffusion list?
- Can't log in HOT 6
- Feature Request: Adding options for setting executablePath puppeteer option
- just ask HOT 1
- Sulla On Raspbian Not Working Correctly HOT 1
- subscribe - Unsubscribe - reolad Pls? HOT 1
- QR Code does not work! HOT 4
- Contacts Status (Stories images, not connection status) HOT 2
- get number connected HOT 4
- Stuck forever on ⠧ Authenticate to continue HOT 3
- profilePicFind Not working
- Verify phone is registered
- Banned HOT 4
- [Question] CRM integrations HOT 5
- Error: Evaluation failed: ReferenceError: webpackJsonp is not defined HOT 2
- How can I block the message from "status@broadcast"
- Authenticate to continue HOT 1
- Cannot establish connection
- can we download destructive images/videos?
- Not proceeding authentication
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 sulla.