node-whatsapp-bot-api
Advanced tools
Comparing version 1.4.4 to 1.4.5
@@ -309,5 +309,5 @@ // Generated by dts-bundle-generator v8.0.1 | ||
export interface IListenerMessage { | ||
contact: IContact; | ||
message_id: string; | ||
metadata: IMetadata; | ||
from: string; | ||
timestamp: number; | ||
@@ -314,0 +314,0 @@ type: AllMessageType; |
@@ -12,3 +12,3 @@ "use strict"; | ||
*/ | ||
function messageHandler(self, message, metadata) { | ||
function messageHandler(self, message, metadata, contact) { | ||
self.logger.info(`Handling message: ${JSON.stringify({ message, metadata })}`); | ||
@@ -27,10 +27,10 @@ const isReplyMessage = repliedToMessage(message); | ||
// Handle text messages | ||
const { timestamp, from, id, text } = message; | ||
const { timestamp, id: message_id, text } = message; | ||
self.logger.info(`Received text message: ${text.body}`); | ||
const textMessage = { | ||
metadata, | ||
contact, | ||
timestamp: +timestamp, | ||
text, | ||
from, | ||
metadata, | ||
message_id: id, | ||
message_id, | ||
type: message_1.AllMessageTypes.TEXT, | ||
@@ -37,0 +37,0 @@ messaging_product: change_1.AllMessagingProductTypes.WHATSAPP, |
@@ -83,3 +83,3 @@ "use strict"; | ||
messages.forEach((message) => { | ||
(0, messageHandler_1.messageHandler)(self, message, metadata); | ||
(0, messageHandler_1.messageHandler)(self, message, metadata, contacts[0]); | ||
}); | ||
@@ -86,0 +86,0 @@ } |
{ | ||
"name": "node-whatsapp-bot-api", | ||
"version": "1.4.4", | ||
"version": "1.4.5", | ||
"description": "WhatsApp Bot that can be used as middleware to emit events to listeners. Listeners can react to incoming messages. Additionally, the WhatsApp bot can send messages if a WhatsApp Cloud API token is provided.", | ||
@@ -12,4 +12,4 @@ "main": "dist/index.js", | ||
"start": "node ./dist/index-bundle.js", | ||
"build": "tsc --project ./tsconfig.json && dts-bundle-generator -o dist/types/index.d.ts ./src/index.ts", | ||
"build:watch": "tsc --watch --project ./tsconfig.json", | ||
"build": "rm -rf ./dist && tsc --project ./tsconfig.json && dts-bundle-generator -o dist/types/index.d.ts ./src/index.ts", | ||
"build:watch": "rm -rf ./dist && tsc --watch --project ./tsconfig.json", | ||
"bundle-types": "dts-bundle-generator -o dist/types/index.d.ts ./src/index.ts", | ||
@@ -16,0 +16,0 @@ "test": "jest --verbose", |
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
57725