whatsapp-api-js
Advanced tools
Comparing version 0.1.3 to 0.1.4
{ | ||
"name": "whatsapp-api-js", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "A Whatsapp Official API helper for Node.js", | ||
@@ -15,3 +15,4 @@ "main": "index.js", | ||
"api", | ||
"helper" | ||
"helper", | ||
"bot" | ||
], | ||
@@ -18,0 +19,0 @@ "author": "Secreto31126", |
@@ -31,2 +31,13 @@ /** | ||
/** | ||
* POST helper callback | ||
* | ||
* @callback postCallback | ||
* @param {String} phoneID The bot's phoneID | ||
* @param {String} phone The user's phone number | ||
* @param {Object} message The messages object | ||
* @param {String} name The username | ||
* @param {Object} raw The raw data from the API | ||
*/ | ||
/** | ||
* POST helper, must be called inside the post function of your code. | ||
@@ -37,3 +48,3 @@ * When setting up the webhook, only subscribe to messages. Other subscritions support might be added later. | ||
* @param {Object} data The post data sent by Whatsapp, already parsed to object | ||
* @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} | ||
* @param {postCallback} callback The function to be called if the post request is valid | ||
* @returns {Number} 200, it's the expected http/s response code | ||
@@ -40,0 +51,0 @@ * @throws {Number} 400 if the POST request isn't valid |
@@ -55,9 +55,9 @@ /** | ||
* | ||
* @param {String} country Full country name | ||
* @param {String} country_code Two-letter country abbreviation | ||
* @param {String} state State abbreviation | ||
* @param {String} city City name | ||
* @param {String} street Street number and name | ||
* @param {String} zip ZIP code | ||
* @param {String} type Address type. Standard Values: HOME, WORK | ||
* @param {String} [country] Full country name | ||
* @param {String} [country_code] Two-letter country abbreviation | ||
* @param {String} [state] State abbreviation | ||
* @param {String} [city] City name | ||
* @param {String} [street] Street number and name | ||
* @param {String} [zip] ZIP code | ||
* @param {String} [type] Address type. Standard Values: HOME, WORK | ||
*/ | ||
@@ -89,5 +89,5 @@ constructor(country, country_code, state, city, street, zip, type) { | ||
constructor(year, month, day) { | ||
if (year.length !== 4) throw new Error("Year must be 4 digits"); | ||
if (month.length !== 2) throw new Error("Month must be 2 digits"); | ||
if (day.length !== 2) throw new Error("Day must be 2 digits"); | ||
if (year?.length !== 4) throw new Error("Year must be 4 digits"); | ||
if (month?.length !== 2) throw new Error("Month must be 2 digits"); | ||
if (day?.length !== 2) throw new Error("Day must be 2 digits"); | ||
this.birthday = `${year}-${month}-${day}`; | ||
@@ -106,4 +106,4 @@ this._ = "birthday"; | ||
* | ||
* @param {String} email Email address | ||
* @param {String} type Email type. Standard Values: HOME, WORK | ||
* @param {String} [email] Email address | ||
* @param {String} [type] Email type. Standard Values: HOME, WORK | ||
*/ | ||
@@ -156,5 +156,5 @@ constructor(email, type) { | ||
* | ||
* @param {String} company Name of the contact's company | ||
* @param {String} department Name of the contact's department | ||
* @param {String} title Contact's business title | ||
* @param {String} [company] Name of the contact's company | ||
* @param {String} [department] Name of the contact's department | ||
* @param {String} [title] Contact's business title | ||
*/ | ||
@@ -177,8 +177,8 @@ constructor(company, department, title) { | ||
* | ||
* @param {String} phone Phone number, automatically populated with the wa_id value as a formatted phone number | ||
* @param {String} type Phone type. Standard Values: CELL, MAIN, IPHONE, HOME, WORK | ||
* @param {String} wa_id WhatsApp ID. If present, number will be ignored. Usually it's the numeric part of the phone number | ||
* @param {String} [phone] Phone number, automatically populated with the wa_id value as a formatted phone number | ||
* @param {String} [type] Phone type. Standard Values: CELL, MAIN, IPHONE, HOME, WORK | ||
* @param {String} [wa_id] WhatsApp ID | ||
*/ | ||
constructor(phone, type, wa_id) { | ||
if (phone && !wa_id) this.phone = phone; | ||
if (phone) this.phone = phone; | ||
if (type) this.type = type; | ||
@@ -198,4 +198,4 @@ if (wa_id) this.wa_id = wa_id; | ||
* | ||
* @param {String} url URL | ||
* @param {String} type URL type. Standard Values: HOME, WORK | ||
* @param {String} [url] URL | ||
* @param {String} [type] URL type. Standard Values: HOME, WORK | ||
*/ | ||
@@ -202,0 +202,0 @@ constructor(url, type) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52983
1081