Skip to content

Commit c647c43

Browse files
authored
Merge pull request #6 from Secreto31126/JSDoc-update
Serious bug took priority in this branch
2 parents 1a8cdd8 + 3ecb138 commit c647c43

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "whatsapp-api-js",
3-
"version": "0.1.3",
3+
"version": "0.1.4",
44
"description": "A Whatsapp Official API helper for Node.js",
55
"main": "index.js",
66
"scripts": {
@@ -12,7 +12,8 @@
1212
"keywords": [
1313
"whatsapp",
1414
"api",
15-
"helper"
15+
"helper",
16+
"bot"
1617
],
1718
"author": "Secreto31126",
1819
"license": "MIT",

requests.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,24 @@ function get(params, verify_token) {
2727
}
2828
}
2929

30+
/**
31+
* POST helper callback
32+
*
33+
* @callback postCallback
34+
* @param {String} phoneID The bot's phoneID
35+
* @param {String} phone The user's phone number
36+
* @param {Object} message The messages object
37+
* @param {String} name The username
38+
* @param {Object} raw The raw data from the API
39+
*/
40+
3041
/**
3142
* POST helper, must be called inside the post function of your code.
3243
* When setting up the webhook, only subscribe to messages. Other subscritions support might be added later.
3344
*
3445
* @ignore
3546
* @param {Object} data The post data sent by Whatsapp, already parsed to object
36-
* @param {Function} callback The function to be called if the post request is valid. The callback is called with the bot's phoneID {String}, the user's phone number {String}, the messages object {Object}, the username {String}, and last the raw data from the API {Object}
47+
* @param {postCallback} callback The function to be called if the post request is valid
3748
* @returns {Number} 200, it's the expected http/s response code
3849
* @throws {Number} 400 if the POST request isn't valid
3950
*/

types/contacts.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ class Phone {
172172
*
173173
* @param {String} [phone] Phone number, automatically populated with the wa_id value as a formatted phone number
174174
* @param {String} [type] Phone type. Standard Values: CELL, MAIN, IPHONE, HOME, WORK
175-
* @param {String} [wa_id] WhatsApp ID. If present, number will be ignored. Usually it's the numeric part of the phone number
175+
* @param {String} [wa_id] WhatsApp ID
176176
*/
177177
constructor(phone, type, wa_id) {
178-
if (phone && !wa_id) this.phone = phone;
178+
if (phone) this.phone = phone;
179179
if (type) this.type = type;
180180
if (wa_id) this.wa_id = wa_id;
181181
this._ = "phones";

0 commit comments

Comments
 (0)