diff --git a/example.js b/example.js index 0646253..aecc146 100644 --- a/example.js +++ b/example.js @@ -193,6 +193,22 @@ client.on('message_revoke_me', async (msg) => { console.log(msg.body); // message before it was deleted. }); +client.on('message_ack', (msg, ack) => { + /* + == ACK VALUES == + ACK_ERROR: -1 + ACK_PENDING: 0 + ACK_SERVER: 1 + ACK_DEVICE: 2 + ACK_READ: 3 + ACK_PLAYED: 4 + */ + + if(ack == 3) { + // The message was read + } +}); + client.on('disconnected', (reason) => { console.log('Client was logged out', reason); }); diff --git a/src/util/Constants.js b/src/util/Constants.js index 738305c..bbfce26 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -91,3 +91,17 @@ exports.WAState = { UNPAIRED: 'UNPAIRED', UNPAIRED_IDLE: 'UNPAIRED_IDLE' }; + +/** + * Message ACK + * @readonly + * @enum {number} + */ +exports.MESSAGE_ACK = { + ACK_ERROR: -1, + ACK_PENDING: 0, + ACK_SERVER: 1, + ACK_DEVICE: 2, + ACK_READ: 3, + ACK_PLAYED: 4, +};