Describe the bug
A clear and concise description of what the bug is.
Steps to Reproduce
async function start(client) {
await client.onMessage(message => {
console.log(message);
if (message.body === 'Hi') {
client.sendText(message.from, '👋 Hello!');
client.sendLocation(message.from, '51.5074', '0.1278', 'LONDON!');
}
});
}
create() code
This is the code you use to create the client. e.g
create('session',
{
headless: false,
executablePath: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe',
},
"WhatsApp/0.4.315 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36"
)
.then(client => start(client));
Expected behavior
I wish i could find a working code example for sendLocation and the sendImage/File function. When i do this the code doesnt throw any error and yet i dont see the location been sent nor the file being sent to the reciepient
DEBUG INFO
This is the info printed to the console when you start your app. It should look like this
Debug Info {
WA_VERSION: '0.4.1296',
PAGE_UA: 'WhatsApp/0.4.315 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36',
SULLA_HOTFIX_VERSION: '1.7.28',
BROWSER_VERSION: 'Chrome/80.0.3987.132'
}
Host (please complete the following information):
same errors here
Can you check if there are any errors in the chrome console

location sending worked with the latest version of WAPI on the console. the SendText function is undefined.
sendText isn't a wapi function
@smashah i tried WAPI.sendLocation("[email protected]",5.55602, -0.1969, "accra") which only returns a Promise {<resolved>: undefined} in the console. So the location is actual showing in the whatsapp web that it has been sent to the specified chatid but not on the phone of the chatid . This seems like what is happening with #98 where the buttons don't get displayed
@smashah I got same error.. sendFile() didnt post anything. In console it return Promise {<pending>}

@irhampro i think you can use sendImage to achieve the same purpose, i just tried it and it works, i think @smashah stated in the readme
await whatsapp.sendImage(
message.from,
"data:binary/octet-stream;base64,UEsDBAoAAAAAAIdO4kAAAAAAAAAAAAAAAAAJAAAAZG9jUHJvcHMvUEsDBBQAAAAIAIdO4kBWLtLiXgEAAHECAAAQAAAAZG9jUHJvcHMvYXBwLnhtbJ2RwW7CMBBE75X6D1HuiZ1AKCBjREM5VS0SoRyR5SzEamJbtkHw93VIBem1t51Zefy0Q+aXpg7OYKxQchYmMQ4DkFyVQh5n4bZYReMwsI7JktVKwiy8gg3n9PmJrI3SYJwAG/gIaWdh5ZyeImR5BQ2zsV9Lvzko0zDnpTkidTgIDkvFTw1Ih1KMRwguDmQJZaTvgWGXOD27/4aWird89qu4ag9MSQGNrpkD+tHi1HGpXEPQ3SVrdgRLE4K6geyUKS3FBHUDyStmGHf+Tq3ZU+RdSP/Sm93gkww7Gqarm9lTpFCO1YVogGYD//ddkQ1nNeSelx5YbYGgh9HGf9utLtSypf/d/zV7cDvhqo1mvCN6YPZ8stC6Fpw5XzjdrTfB562UfZLEaYzj8WSS7FfJ2yB9ec2jdDTJo+EgK6NFkqURzvJsiMc===",
"mcroni.docx",
"You just sent me this"
);
this isnt a valid base64 but this works for me
My sendFile() is working right now.. I just forgot to put mime before base64 string. Also work with sendImage() thx @mcroni .
this is really strange, now the sendLocation works on both web and can be seen on the receipient's phone.
Ok I'll close this for now then. Please report back if it happens again. Thanks
the sendGiphy error:
Access to XMLHttpRequest at 'https://mmg-fna.whatsapp.net/mms/gif/2qXYcoSC_0B5890NHbe_NzDoa0maNCjb5CftFqwxuvY=?auth=AWR7BpNmyLgWD0iI3uJIxWygWWJ2DNwDesmNLVBTaoz7YPylGA0MB5vxjls&token=2qXYcoSC_0B5890NHbe_NzDoa0maNCjb5CftFqwxuvY%3D&resume=1' from origin 'https://web.whatsapp.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
the sendLocation error:
Uncaught (in promise) Error: MsgKey error: something's not a wid: from:[email protected] to:[email protected] p:[email protected]
at new e (app2.a9872fe34c195f62f27b.js:2)
at t.value (app2.a9872fe34c195f62f27b.js:2)
at l (app2.a9872fe34c195f62f27b.js:2)
at a (app2.a9872fe34c195f62f27b.js:2)
at app2.a9872fe34c195f62f27b.js:2
at Array.forEach (
at t.default (app2.a9872fe34c195f62f27b.js:2)
at t.default (app2.a9872fe34c195f62f27b.js:2)
at app.a8aee3263acf3b647bd5.js:2
the sendLocation doesn't seem to work all the time, @marcelocecin can you kindly paste an example code to help us with better debugging
I'm using the server.ts demo
I am unable to recreate this, everything seems to be working fine based on demo/index.ts
I'm going to instigate a new release, please update and try again.
@github-actions run
âš¡ Release! âš¡
(async () => {
function exec(cmd) {
console.log(execSync(cmd).toString());
}
// Config
const gitUserEmail = "github-actions[bot]@users.noreply.github.com";
const gitUserName = "github-actions[bot]";
exec(`echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc`);
exec(`git config --global user.email "${gitUserEmail}"`);
exec(`git config --global user.name "${gitUserName}"`);
exec(`npm i`);
exec(`npm run release-ci`);
var result = execSync(`npx auto-changelog -o ./tempchangelog.txt --commit-limit false --template ./compact-keepachangelog.hbs --stdout`).toString();
await postComment('🤖 JOB DONE \n' +result);
})();
still with error:
vendor1.d7aea56a0442ed48f400.js:12 Error: MsgKey error: something's not a wid: from:[email protected] to:[email protected] p:undefined
at new e (app2.a9872fe34c195f62f27b.js:2)
at Object.t.createQuotedMsg (app2.a9872fe34c195f62f27b.js:2)
at t.value [as _getQuotedMsgObj] (app2.a9872fe34c195f62f27b.js:2)
at t.value [as quotedMsgObj] (app2.a9872fe34c195f62f27b.js:2)
at o.value (app.a8aee3263acf3b647bd5.js:2)
at t.value (app2.a9872fe34c195f62f27b.js:2)
at t.value (app2.a9872fe34c195f62f27b.js:2)
at mo (vendor1.d7aea56a0442ed48f400.js:12)
at bo (vendor1.d7aea56a0442ed48f400.js:12)
at ql (vendor1.d7aea56a0442ed48f400.js:12)
No @ vendor1.d7aea56a0442ed48f400.js:12
Xo.a.componentDidCatch.n.callback @ vendor1.d7aea56a0442ed48f400.js:12
Vi @ vendor1.d7aea56a0442ed48f400.js:12
Fi @ vendor1.d7aea56a0442ed48f400.js:12
(anonymous) @ vendor1.d7aea56a0442ed48f400.js:12
t.unstable_runWithPriority @ vendor1.d7aea56a0442ed48f400.js:20
si @ vendor1.d7aea56a0442ed48f400.js:12
Wl @ vendor1.d7aea56a0442ed48f400.js:12
Nl @ vendor1.d7aea56a0442ed48f400.js:12
(anonymous) @ vendor1.d7aea56a0442ed48f400.js:12
t.unstable_runWithPriority @ vendor1.d7aea56a0442ed48f400.js:20
si @ vendor1.d7aea56a0442ed48f400.js:12
pi @ vendor1.d7aea56a0442ed48f400.js:12
hi @ vendor1.d7aea56a0442ed48f400.js:12
Ol @ vendor1.d7aea56a0442ed48f400.js:12
enqueueSetState @ vendor1.d7aea56a0442ed48f400.js:12
x.setState @ vendor1.d7aea56a0442ed48f400.js:31
e.handleOpenChat @ app2.a9872fe34c195f62f27b.js:2
(anonymous) @ app.a8aee3263acf3b647bd5.js:2
value @ app.a8aee3263acf3b647bd5.js:2
value @ app.a8aee3263acf3b647bd5.js:2
(anonymous) @ app.a8aee3263acf3b647bd5.js:2
re @ app.a8aee3263acf3b647bd5.js:2
P @ app.a8aee3263acf3b647bd5.js:2
value @ app.a8aee3263acf3b647bd5.js:2
value @ app.a8aee3263acf3b647bd5.js:2
value @ app.a8aee3263acf3b647bd5.js:2
(anonymous) @ app2.a9872fe34c195f62f27b.js:2
oe @ app.a8aee3263acf3b647bd5.js:2
ae @ app.a8aee3263acf3b647bd5.js:2
@marcelocecin despite the error, did it show up? That can also happen when there's a corrupted message in the chat. I suggest deleting the chat, trying again and ignoring that message if the message actually gets sent properly. Until I have reproducible instructions there's not much else I can do.