From 205f9f9967091f71b72c5d18ec2e7b1935a3f7da Mon Sep 17 00:00:00 2001 From: ripreal Date: Fri, 14 Oct 2022 10:38:56 +0300 Subject: [PATCH] Remove phoneNumber from docs --- README.md | 12 +++++++----- README_RUS.md | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 1ca3501..d4409b6 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,8 @@ WhatsApp mobile app authentication may be achived by using [control panel](https ## Examples +Please do not use 'phoneNumber' parameter when calling methods. It is deprecated. Examples below are based on 'chatId' paramemeter + ### Send WhatsApp message Use common javascript @@ -68,7 +70,7 @@ const restAPI = whatsAppClient.restAPI({ apiTokenInstance: "YOUR_API_TOKEN_INSTANCE", }); -restAPI.message.sendMessage(null, 79999999999, "hello world").then((data) => { +restAPI.message.sendMessage("79999999999@c.us", null , "hello world").then((data) => { console.log(data); }); ``` @@ -83,7 +85,7 @@ or use browser js script apiTokenInstance: "YOUR_API_TOKEN_INSTANCE", }); restAPI.message - .sendMessage(null, 79999999999, "hello world") + .sendMessage("79999999999@c.us", null, "hello world") .then((data) => { console.log(data); }) @@ -104,8 +106,8 @@ import whatsAppClient from "@green-api/whatsapp-api-client"; apiTokenInstance: "YOUR_API_TOKEN_INSTANCE", }); const response = await restAPI.message.sendMessage( + "79999999999@c.us", null, - 79999999999, "hello world" ); })(); @@ -171,8 +173,8 @@ import whatsAppClient from "@green-api/whatsapp-api-client"; apiTokenInstance: "YOUR_API_TOKEN_INSTANCE", }); const response = await restAPI.file.sendFileByUrl( + "79999999999@c.us", null, - 79999999999, "https://avatars.mds.yandex.net/get-pdb/477388/77f64197-87d2-42cf-9305-14f49c65f1da/s375", "horse.png", "horse" @@ -218,8 +220,8 @@ import bodyParser from "body-parser"; }); // Send test message that triggers webhook const response = await restAPI.message.sendMessage( + "79999999999@c.us", null, - 79999999999, "hello world" ); }); diff --git a/README_RUS.md b/README_RUS.md index 2128bd8..0211760 100644 --- a/README_RUS.md +++ b/README_RUS.md @@ -47,6 +47,8 @@ import * as whatsAppClient from "@green-api/whatsapp-api-client"; ## Примеры +Не испольуйте параметр 'phoneNumber' при вызове методов. Он устарел. Примеры ниже используют параметр 'chatId' + ### Отправка сообщения на номер WhatsApp Используя common js ``` js @@ -57,7 +59,7 @@ const restAPI = whatsAppClient.restAPI(({ apiTokenInstance: YOUR_API_TOKEN_INSTANCE })) -restAPI.message.sendMessage(null, 79999999999, "hello world") +restAPI.message.sendMessage("79999999999@c.us", null, "hello world") .then((data) => { console.log(data); }) ; @@ -71,7 +73,7 @@ restAPI.message.sendMessage(null, 79999999999, "hello world") idInstance: "YOUR_ID_INSTANCE", apiTokenInstance: "YOUR_API_TOKEN_INSTANCE" })) - restAPI.message.sendMessage(null, 79999999999, "hello world") + restAPI.message.sendMessage("79999999999@c.us", null, "hello world") .then((data) => { console.log(data); }).catch((reason) =>{ @@ -89,7 +91,7 @@ import whatsAppClient from '@green-api/whatsapp-api-client' idInstance: YOUR_ID_INSTANCE, apiTokenInstance: YOUR_API_TOKEN_INSTANCE })) - const response = await restAPI.message.sendMessage(null, 79999999999, "hello world"); + const response = await restAPI.message.sendMessage("79999999999@c.us", null, "hello world"); })(); ``` @@ -150,7 +152,7 @@ import whatsAppClient from '@green-api/whatsapp-api-client' idInstance: YOUR_ID_INSTANCE, apiTokenInstance: YOUR_API_TOKEN_INSTANCE })) - const response = await restAPI.file.sendFileByUrl(null, 79999999999, 'https://avatars.mds.yandex.net/get-pdb/477388/77f64197-87d2-42cf-9305-14f49c65f1da/s375', 'horse.png', 'horse'); + const response = await restAPI.file.sendFileByUrl("79999999999@c.us", null, 'https://avatars.mds.yandex.net/get-pdb/477388/77f64197-87d2-42cf-9305-14f49c65f1da/s375', 'horse.png', 'horse'); })(); ``` @@ -190,7 +192,7 @@ import bodyParser from 'body-parser'; apiTokenInstance: MY_API_TOKEN_INSTANCE })); // Отправляем тестовое сообщение, для того чтобы сработали события вебхуков - const response = await restAPI.message.sendMessage(null, 79999999999, "hello world"); + const response = await restAPI.message.sendMessage("79999999999@c.us", null, "hello world"); }); } catch (error) {