asaf david
asaf david

Reputation: 43

whatsapp Chat-API fail [reason] => old_version

Hello I am trying to get Whatsapp chat-api to work in php,
using the exampleRegister.php. I am trying to get the password from the server but it keeps giving me an error

=> fail [reason] => old_version ) 
Fatal error: Uncaught exception 'Exception' with message 'There was a problem trying to request the code.' in C:\xampp\htdocs\sendwhatsappmsg\Chat-API-master\Chat-API-master\src\Registration.php:316 Stack trace: #0 C:\xampp\htdocs\sendwhatsappmsg\Chat-API-master\Chat-API-master\examples\exampleRegister.php(41): Registration->codeRequest('sms') #1 {main} thrown in C:\xampp\htdocs\sendwhatsappmsg\Chat-API-master\Chat-API-master\src\Registration.php on line 316

I already tried to update it with composer and download multi files from Github
all of them seem to give this error not sure what am doing wrong or maybe this api no longer works
any help or tip will be welcome.
If anyone know other Whatsapp api or better way to send msg from localserver/php to Whatsapp users please share :)

Upvotes: 1

Views: 4873

Answers (3)

Azam Alvi
Azam Alvi

Reputation: 7055

For latest version you need to change in composer.json file like this

"require": {
    "whatsapp/chat-api": "dev-master"
}

After updating composer, you need to change the Constants like below

Constants.php

const WHATSAPP_VER = '2.18.8';
const WHATSAPP_USER_AGENT = 'WhatsApp/2.18.8 Android/4.3 Device/Xiaomi-HM_1SW';

token.php

$classesMd5 = 'CjxZj9h0ptjV2RRSfH9aYA==';

This should fix both problems (bad_token and old_version)

Upvotes: 5

Buwaneka Kalansuriya
Buwaneka Kalansuriya

Reputation: 146

Check the latest version of Whatsapp using google. eg:-2.17.286 (2017-08-08) Then in the vendor/whatsapp/chat-api/src you'll find a file: Constants.php. Update the following constants:

const WHATSAPP_VER = '2.17.286';
const WHATSAPP_USER_AGENT = 'WhatsApp/2.17.286 Android/4.3 Device/Xiaomi-HM_1SW';

This solved my issue.

Upvotes: 1

user7982830
user7982830

Reputation: 1

U have to update var $classesMd5 in token.php. Use this programm https://github.com/mgp25/classesMD5-64 (last toke is "5PhjPwAEWaaPFD4h3nM0hA==", also find here https://coderus.openrepos.net/whitesoft/whatsapp_scratch)

Also u have to update Constains.php , set

WHATSAPP_VER = '2.16.11'
WHATSAPP_USER_AGENT = 'WhatsApp/2.17.174 Android/4.4.4 Device/Samsung-Galaxy_S3

'

Upvotes: -2

Related Questions