Fires callback with Chat object every time the host phone is added to a group.
callback function that handles a Chat (group chat) as the first and only parameter.
true
if the callback was registered
Listens to battery changes
callback
Fires callback with the relevant chat id every time the user clicks on a chat. This will only work in headful mode.
callback function that handles a ChatId as the first and only parameter.
true
if the callback was registered
Listens to add and remove events on Groups on a global level. It is memory efficient and doesn't require a specific group id to listen to.
callback function that handles a ParticipantChangedEventModel as the first and only parameter.
true
if the callback was registered
the chat from which you want to subscribes to live location updates
callback that takes in a LiveLocationChangedEvent
boolean, if returns false then there were no valid live locations in the chat of chatId
Listens to a log out event
callback
A priority of -1 will mean the callback will be triggered after all the non -1 callbacks
group id: xxxxx-yyyy@c.us
callback
Observable stream of participantChangedEvent
Listens to when host device is plugged/unplugged
callback
Listens to reaction add and change events
callback
Fires callback with Chat object every time the host phone is removed to a group.
callback function that handles a Chat (group chat) as the first and only parameter.
true
if the callback was registered
Adds label from chat, message or contact. Only for business accounts.
Add participant to Group
If not a group chat, returns NOT_A_GROUP_CHAT
.
If the chat does not exist, returns GROUP_DOES_NOT_EXIST
If the participantId does not exist in the contacts, returns NOT_A_CONTACT
If the host account is not an administrator, returns INSUFFICIENT_PERMISSIONS
The id of the conversation
boolean true => archive, false => unarchive
boolean true: worked, false: didnt work (probably already in desired state)
Automatically reject calls on the host account device. Please note that the device that is calling you will continue to ring.
Update: Due to the nature of MD, the host account will continue ringing.
optional message to send to the calling account when their call is detected and rejected
[FROM DISCORDJS] Similar to createMessageCollector but in promise form. Resolves with a collection of messages that pass the specified filter.
The Mesasge/Chat or Chat Id to base this message colletor on
The filter function to use
Checks if a number is a valid WA number
Check if a recipient has read receipts on.
This will only work if you have chats sent back and forth between you and the contact 1-1.
The Id of the contact with which you have an existing conversation with messages already.
Promise<string | boolean>
true or false or a string with an explaintaion of why it wasn't able to determine the read receipts.
Clears all chats of all messages. This does not delete chats. Please be careful with this as it will remove all messages from whatsapp web and the host device. This feature is great for privacy focussed bots.
number A chat that has had a message after ts (epoch timestamp) will not be cleared.
Delete all messages from the chat.
boolean
Block contact
Unblock contact
Create a group and add contacts to it
Adds label from chat, message or contact. Only for business accounts.
false
if something went wrong, or the id (usually a number as a string) of the new label (for example "58"
)
Returns a new message collector for the chat which is related to the first parameter c
The Mesasge/Chat or Chat Id to base this message colletor on
A function that consumes a [Message] and returns a boolean which determines whether or not the message shall be collected.
The options for the collector. For example, how long the collector shall run for, how many messages it should collect, how long between messages before timing out, etc.
Add a product to your catalog
The name of the product
The price of the product
The 3-letter currenct code for the product
An array of dataurl or base64 strings of product images, the first image will be used as the main image. At least one image is required.
optional, the description of the product
The url of the product for more information
The internal/backoffice id of the product
Whether or not the product is shown publicly in your catalog
product object
This simple function halves the amount of chats in your session message cache. This does not delete messages off your phone. If over a day you've processed 4000 messages this will possibly result in 4000 messages being present in your session.
Calling this method will cut the message cache as much as possible, reducing the memory usage of your process.
You should use this in conjunction with getAmountOfLoadedMessages
to intelligently control the session message cache.
This simple function halves the amount of messages in your session message cache. This does not delete messages off your phone. If over a day you've processed 4000 messages this will possibly result in 4000 messages being present in your session.
Calling this method will cut the message cache to 2000 messages, therefore reducing the memory usage of your process.
You should use this in conjunction with getAmountOfLoadedMessages
to intelligently control the session message cache.
Start dark mode [NOW GENERALLY AVAILABLE]
true to activate dark mode, false to deactivate
Deletes all your existing statuses.
boolean. True if it worked.
Delete the conversation from your WA
boolean
Deletes message of given message id
The chat id from which to delete the message.
The specific message id of the message to be deleted
If it should only delete locally (message remains on the other recipienct's phone). Defaults to false.
nothing
Deletes chats from a certain index (default 1000). E.g if this startingFrom param is 100
then all chats from index 100
onwards will be deleted.
the chat index to start from. Please do not set this to anything less than 10 @default: 1000
Consumes a list of id strings of statuses to delete.
string [] | stringan array of ids of statuses to delete.
boolean. True if it worked.
Demote Admin of Group
If not a group chat, returns NOT_A_GROUP_CHAT
.
If the chat does not exist, returns GROUP_DOES_NOT_EXIST
If the participantId does not exist in the group chat, returns NOT_A_PARTICIPANT
If the host account is not an administrator, returns INSUFFICIENT_PERMISSIONS
A convinience method to download the DataURL of a file
The url
You can use this to override the axios request config
Promise<DataURL>
Download via the browsers authenticated session via URL.
base64 string (non-data url)
Download profile pics from the message object.
const filename = `profilepic_${message.from}.jpeg`;
const data = await client.downloadProfilePicFromMessage(message);
const dataUri = `data:image/jpeg;base64,${data}`;
fs.writeFile(filename, mData, 'base64', function(err) {
if (err) {
return console.log(err);
}
console.log('The file was saved!');
});
Edit a product in your catalog
The catalog ID of the product
The name of the product
The price of the product
The 3-letter currenct code for the product
An array of dataurl or base64 strings of product images, the first image will be used as the main image. At least one image is required.
optional, the description of the product
The url of the product for more information
The internal/backoffice id of the product
Whether or not the product is shown publicly in your catalog
product object
Fires all unread messages to the onMessage listener. Make sure to call this AFTER setting your listeners.
array of message IDs
This is a convinient method to click the Use Here
button in the WA web session.
Use this when STATE is CONFLICT
. You can read more about managing state here:
[[Detecting Logouts]]
If a file is old enough, it will 404 if you try to decrypt it. This will allow you to force the host account to re upload the file and return a decryptable message.
if you run this without a valid insiders key, it will return false and cause an error upon decryption.
Message OR false
Forces the session to update the connection state. This will take a few seconds to determine the 'correct' state.
updated connection state
A list of participants in the chat who have their live location on. If the chat does not exist, or the chat does not have any contacts actively sharing their live locations, it will return false. If it's a chat with a single contact, there will be only 1 value in the array if the contact has their livelocation on. Please note. This should only be called once every 30 or so seconds. This forces the phone to grab the latest live location data for the number. This can be used in conjunction with onLiveLocation (this will trigger onLiveLocation).
string Id of the chat you want to force the phone to get the livelocation data for.
Promise<LiveLocationChangedEvent []>
| boolean
Forward an array of messages to a specific chat using the message ids or Objects
this can be any mixture of message ids or message objects
This indicates whether or not to skip your own messages from the array
It calls the JavaScript garbage collector
Nothing.
retrieves all Chat Ids
array of [ChatId]
Retrieves all chats
array of [Chat]
array of [Chat]
Retrieves all contacts
array of [Contact]
Retrieve all groups
array of groups
Returns all labels and the corresponding tagged items.
Retrieves all new Messages. where isNewMsg==true
list of messages
Retrieves all unread Messages. where ack==-1
list of messages
Easily get the amount of messages loaded up in the session. This will allow you to determine when to clear chats/cache.
Retrieves Battery Level
Number
retrieves an array of IDs of accounts blocked by the host account.
Promise<ChatId[]>
Find any product listings of the given number. Use this to query a catalog
id of buseinss profile (i.e the number with @c.us)
None
Returns a list of contact with whom the host number has an existing chat who are also not contacts.
Get an array of chats that match the label parameter. For example, if you want to get an array of chat objects that have the label "New customer".
This method is case insenstive and only works on business host accounts.
Retrieves the groups that you have in common with a contact
Promise returning an array of common groups { id:string, title:string }
Get the config which was used to set up the client. Sensitive details (like devTools username and password, and browserWSEndpoint) are scrubbed
SessionInfo
Returns the connection state
Get the generated user agent, this is so you can send it to the decryption module.
String useragent of wa-web session
Get Admins of a Group
Returns the title and description of a given group id.
group id
Retrieves an invite link for a group chat. returns false if chat is not a group.
Promise<string>
Returns group members [Contact] objects
Retrieves group members as [Id] objects
group id
Retrieves the host device number. Use this number when registering for a license key
Number
Retrieves all unread Messages as indicated by the red dots in WA web. This returns an array of objects and are structured like so:
[{
"id": "000000000000@g.us", //the id of the chat
"indicatedNewMessages": [] //array of messages, not including any messages by the host phone
}]
list of messages
Get the INSTANCE_ID of the current session
Retrieves whether or not phone is plugged in (i.e on charge)
Number
Generate a pre-filled github issue link to easily report a bug
Returns an array of group ids where the host account has been kicked
Get an array of chatIds with their respective last message's timestamp.
This is useful for determining what chats are old/stale and need to be deleted.
Retrieves the epoch timestamp of the time the contact was last seen. This will not work if:
The id of the chat.
number timestamp when chat was last online or undefined.
Returns the the type of license key used by the session.
If you have set onAnyMessage
or onMessage
with the second parameter (PQueue options) then you may want to inspect their respective PQueue's.
Returns an object with all of your host device details
Get the detailed message info for a group message sent out by the host account.
The message Id
Returns an array of contacts that have read the message. If the message does not exist, it will return an empty array. If the host account has disabled read receipts this may not work!
Each of these contact objects have a property t
which represents the time at which that contact read the message.
The message id
retrieves all existing statuses.
Only works with a Story License Key
Get the stats of the current process and the corresponding browser process.
Retrieves chat picture
Url of the chat picture or undefined if there is no picture for the chat.
Get the session info
SessionInfo
This allows you to get a single property of a single object from the session. This limints the amouunt of data you need to sift through, reduces congestion between your process and the session and the flexibility to build your own specific getters.
Example - get message read state (ack):
const ack = await client.getSingleProperty('Msg',"true_12345678912@c.us_9C4D0965EA5C09D591334AB6BDB07FEB",'ack')
id of the object to get from the specific namespace
the single property key to get from the object.
any If the property or the id cannot be found, it will return a 404
Get the status of a contact
to '000000000000@c.us' returns: {id: string,status: string}
Retrieves an array of user ids that have 'read' your story.
string The id of the story
Only works with a Story License Key
Retrieves all undread Messages
any
Retreive an array of messages that are not yet sent to the recipient via the host account device (i.e no ticks)
Extracts vcards from a message.This works on messages of typ vcard
or multi_vcard
string id of the message to extract the vcards from
[
{
displayName:"Contact name",
vcard: "loong vcard string"
}
]
or false if no valid vcards found.
Please use vcf to convert a vcard string into a json object
Runs a health check to help you determine if/when is an appropiate time to restart/refresh the session.
Returns an array of group ids where the host account is admin
Get the details of a group through the invite link
This can be an invite link or invite code
Checks if a chat is muted
The id of the chat you want to check
boolean. false
if the chat does not exist.
Checks if a chat contact is online. Not entirely sure if this works with groups.
It will return true
if the chat is online
, false
if the chat is offline
, PRIVATE
if the privacy settings of the contact do not allow you to see their status and NO_CHAT
if you do not currently have a chat with that contact.
chat id: xxxxx@c.us
Retrieves if the phone is online. Please note that this may not be real time.
Boolean
Checks whether or not the group id provided is known to be unsafe by the contributors of the library.
The group chat you want to deteremine is unsafe
Promise <boolean | string>
This will either return a boolean indiciating whether this group chat id is considered unsafe or an error message as a string
Check if the "Phone not Cconnected" message is showing in the browser. If it is showing, then this will return true
.
boolean
Joins a group via the invite link, code, or message
This param is the string which includes the invite link or code. The following work:
If you have been removed from the group previously, it will return 401
boolean When this is set to true and if the group was joined successfully, it will return a serialzed Chat object which includes group information and metadata. This is useful when you want to immediately do something with group metadata.
Promise<string | boolean | number>
Either false if it didn't work, or the group id.
Shuts down the page and browser
true
Removes the host device from the group
group id
Retreives an array of webhook objects
Grab the logger for this session/process
Logs out from the session.
skip session.data.json file invalidation Please be careful when using this as it can exit the whole process depending on your config
Runs sendSeen on all chats
Sets a chat status to unread. May be useful to get host's attention
chat id: xxxxx@c.us
Returns some metrics of the session/page.
Promise<any>
This exposes a simple express middlware that will allow users to quickly boot up an api based off this client. Checkout demo/index.ts for an example How to use the middleware:
import { create } from '@open-wa/wa-automate';
const express = require('express')
const app = express()
app.use(express.json())
const PORT = 8082;
function start(client){
app.use(client.middleware()); //or client.middleware(true) if you require the session id to be part of the path (so localhost:8082/sendText beccomes localhost:8082/sessionId/sendText)
app.listen(PORT, function () {
console.log(`\n• Listening on port ${PORT}!`);
});
...
}
create({
sessionId:'session1'
}).then(start)
All requests need to be POST
requests. You use the API the same way you would with client
. The method can be the path or the method param in the post body. The arguments for the method should be properly ordered in the args array in the JSON post body.
Example:
await client.sendText('4477777777777@c.us','test')
//returns "true_4477777777777@c.us_3EB0645E623D91006252"
as a request with a path:
const axios = require('axios').default;
axios.post('localhost:8082/sendText', {
args: [
"4477777777777@c.us",
"test"
]
})
or as a request without a path:
const axios = require('axios').default;
axios.post('localhost:8082', {
method:'sendText',
args: [
"4477777777777@c.us",
"test"
]
})
As of 1.9.69, you can also send the argyments as an object with the keys mirroring the paramater names of the relative client functions
Example:
const axios = require('axios').default;
axios.post('localhost:8082', {
method:'sendText',
args: {
"to":"4477777777777@c.us",
"content":"test"
}
})
boolean Set this to true if you want to keep each session in it's own path.
For example, if you have a session with id host
if you set useSessionIdInPath to true, then all requests will need to be prefixed with the path host
. E.g localhost:8082/sendText
becomes localhost:8082/host/sendText
Mutes a conversation for a given duration. If already muted, this will update the muted duration. Mute durations are relative from when the method is called.
The id of the conversation you want to mute
ChatMuteDuration enum of the time you want this chat to be muted for.
boolean true: worked or error code or message
Pin/Unpin chats
The id of the conversation
boolean true: worked
Sends a formatted text story.
The text to be displayed in the story
The colour of the text in the story in hex format, make sure to add the alpha value also. E.g "#FF00F4F2"
The colour of the background in the story in hex format, make sure to add the alpha value also. E.g "#4FF31FF2"
The font of the text to be used in the story. This has to be a number. Each number refers to a specific predetermined font. Here are the fonts you can choose from: 0: Sans Serif 1: Serif 2: Norican Regular 3: Bryndan Write 4: Bebasneue Regular 5: Oswald Heavy
Promise<string | boolean>
returns status id if it worked, false if it didn't
Promote Participant to Admin in Group
If not a group chat, returns NOT_A_GROUP_CHAT
.
If the chat does not exist, returns GROUP_DOES_NOT_EXIST
If the participantId does not exist in the group chat, returns NOT_A_PARTICIPANT
If the host account is not an administrator, returns INSUFFICIENT_PERMISSIONS
React to a message
Message ID of the message you want to react to
1 single emoji to add to the message as a reacion
boolean
Refreshes the page and reinjects all necessary files. This may be useful for when trying to save memory This will attempt to re register all listeners EXCEPT onLiveLocation and onParticipantChanged
The client can now automatically handle webhooks. Use this method to register webhooks.
The webhook url
An array of SimpleListener enums or all
(to register all possible listeners)
By default the request is a post request, however you can override that and many other options by sending this parameter. You can read more about this parameter here: https://github.com/axios/axios#request-config
the amount of concurrent requests to be handled by the built in queue. Default is 5.
A webhook object. This will include a webhook ID and an array of all successfully registered Listeners.
Removes label from chat, message or contact. Only for business accounts.
//////////////////////// LISTENERS
Remove participant of Group
If not a group chat, returns NOT_A_GROUP_CHAT
.
If the chat does not exist, returns GROUP_DOES_NOT_EXIST
If the participantId does not exist in the group chat, returns NOT_A_PARTICIPANT
If the host account is not an administrator, returns INSUFFICIENT_PERMISSIONS
0000000000-00000000@g.us
000000000000@c.us
Remove a product from the host account's catalog
The id of the product
boolean
Removes a webhook.
Returns true
if the webhook was found and removed. false
if the webhook was not found and therefore could not be removed. This does not unregister any listeners off of other webhooks.
The ID of the webhook
Sends a reply to a given message. Please note, you need to have at least sent one normal message to a contact in order for this to work properly.
string chatid
string reply text
string the msg id to reply to.
boolean If set to true, the chat will 'blue tick' all messages before sending the reply
Promise<MessageId | false>
false if didn't work, otherwise returns message id.
Report a contact for spam, block them and attempt to clear chat.
Revokes the current invite link for a group chat. Any previous links will stop working
Promise<boolean>
{@license:insiders@}
Send advanced buttons with media body. This is an insiders feature for MD accounts.
Body can be location, image, video or document. Buttons can be quick reply, url or call buttons.
chat id
The body of the buttons message
Array of buttons - limit is 3!
The footer of the buttons message
Required if body is a file!!
Send generic quick reply buttons. This is an insiders feature for MD accounts.
chat id
The body of the buttons message
Array of buttons - limit is 3!
The title/header of the buttons message
The footer of the buttons message
Send a discord emoji to a chat as a sticker
ChatId The chat id you want to send the webp sticker to
The discord emoji id without indentifying chars. In discord you would write :who:
, here use who
message id of the message you want this sticker to reply to. REQUIRES AN INSIDERS LICENSE-KEY
Sends a file to given chat, with caption or not, using base64. This is exactly the same as sendImage
Please note that any file that resolves to mime-type octet-stream
will, by default, resolve to an MP4 file.
If you want a specific filetype, then explcitly select the correct mime-type from https://www.iana.org/assignments/media-types/media-types.xhtml
chat id xxxxx@c.us
DataURL data:image/xxx;base64,xxx or the RELATIVE (should start with ./
or ../
) path of the file you want to send. With the latest version, you can now set this to a normal URL (for example [GET] https://file-examples-com.github.io/uploads/2017/10/file_example_JPG_2500kB.jpg
).
string xxxxx
string xxxxx With an INSIDERS LICENSE-KEY you can also tag people in groups with @[number]
. For example if you want to mention the user with the number 44771234567
, just add @44771234567
in the caption.
string true_0000000000@c.us_JHB2HB23HJ4B234HJB to send as a reply to a message
boolean default: false set this to true if you want to wait for the id of the message. By default this is set to false as it will take a few seconds to retrieve to the key of the message and this waiting may not be desirable for the majority of users.
boolean default: false set this to true if you want to send the file as a push to talk file.
boolean default: false set this to true if you want to send the file without a preview (i.e as a file). This is useful for preventing auto downloads on recipient devices.
boolean default: false [INSIDERS] set this to try silent tag someone in the caption
Promise <boolean | MessageId>
This will either return true or the id of the message. It will return true after 10 seconds even if waitForId is true
Sends a file by Url or custom options
chat id xxxxx@c.us
string 'video.mp4'
string xxxxx
string true_0000000000@c.us_JHB2HB23HJ4B234HJB to send as a reply to a message
By default the request is a get request, however you can override that and many other options by sending this parameter. You can read more about this parameter here: https://github.com/axios/axios#request-config
boolean default: false set this to true if you want to wait for the id of the message. By default this is set to false as it will take a few seconds to retrieve to the key of the message and this waiting may not be desirable for the majority of users.
boolean default: false set this to true if you want to send the file as a push to talk file.
boolean default: false set this to true if you want to send the file without a preview (i.e as a file). This is useful for preventing auto downloads on recipient devices.
Send a giphy GIF as an animated sticker.
ChatId
URL | string This is the giphy media url and has to be in the format https://media.giphy.com/media/RJKHjCAdsAfQPn03qQ/source.gif
or it can be just the id RJKHjCAdsAfQPn03qQ
Sends a image to given chat, with caption or not, using base64
chat id xxxxx@c.us
DataURL data:image/xxx;base64,xxx or the RELATIVE (should start with ./
or ../
) path of the file you want to send. With the latest version, you can now set this to a normal URL (for example [GET] https://file-examples-com.github.io/uploads/2017/10/file_example_JPG_2500kB.jpg
).
string xxxxx
string xxxxx
boolean default: false [INSIDERS] set this to try silent tag someone in the caption
Promise <boolean | string>
This will either return true or the id of the message. It will return true after 10 seconds even if waitForId is true
This function takes an image (including animated GIF) and sends it as a sticker to the recipient. This is helpful for sending semi-ephemeral things like QR codes. The advantage is that it will not show up in the recipients gallery. This function automatiicaly converts images to the required webp format.
This function takes an image and sends it as a sticker to the recipient as a reply to another message.
The recipient id.
The id of the message to reply to
Sticker metadata
Sends product with image to chat
string the caption you want to add to this message
string the @c.us number of the business account from which you want to grab the product
string the id of the product within the main catalog of the aforementioned business
Automatically sends a link with the auto generated link preview. You can also add a custom message.
string A link.
string Custom text as body of the message, this needs to include the link or it will be appended after the link.
Base64 of the jpeg/png which will be used to override the automatically generated thumbnail.
{@license:insiders@}
REQUIRES AN INSIDERS LICENSE-KEY
Send a list message. This will not work when being sent from business accounts!
The Sections of rows for the list message
The title of the list message
The description of the list message
The action text of the list message
Note: address
and url
are parameters available to insiders only.
Sends a location message to given chat
chat id: xxxxx@c.us
latitude: '51.5074'
longitude: '0.1278'
location text: 'LONDON!'
address text: '1 Regents Park!'
address text link: 'https://example.com'
Sends a link to a chat that includes a link preview.
The base 64 data of the image you want to use as the thunbnail. This should be no more than 200x200px. Note: Dont need data url on this param
The link you want to send
The title of the link
The long description of the link preview
The text you want to inslude in the message section. THIS HAS TO INCLUDE THE URL otherwise the url will be prepended to the text automatically.
The chat you want to send this message to.
Use this to send an mp4 file as a sticker. This can also be used to convert GIFs from the chat because GIFs in WA are actually tiny mp4 files.
ChatId The chat id you want to send the webp sticker to
message id of the message you want this sticker to reply to. REQUIRES AN INSIDERS LICENSE-KEY
[UNTESTED - REQUIRES FEEDBACK] Sends a payment request message to given chat
chat id: xxxxx@c.us
number the amount to request in 1000 format (e.g £10 => 10000)
string The 3 letter currency code
string optional message to send with the payment request
Attempts to send a file as a voice note. Useful if you want to send an mp3 file.
chat id xxxxx@c.us
base64 data:image/xxx;base64,xxx or the path of the file you want to send.
string true_0000000000@c.us_JHB2HB23HJ4B234HJB to send as a reply to a message
Promise <boolean | string>
This will either return true or the id of the message. It will return true after 10 seconds even if waitForId is true
You can use this to send a raw webp file.
ChatId The chat id you want to send the webp sticker to
Base64 The base64 string of the webp file. Not DataURl
Boolean Set to true if the webp is animated. Default false
You can use this to send a raw webp file.
ChatId The chat id you want to send the webp sticker to
MessageId Message ID of the message to reply to
Base64 The base64 string of the webp file. Not DataURl
Boolean Set to true if the webp is animated. Default false
Sends a reply to given chat that includes mentions, replying to the provided replyMessageId. In order to use this method correctly you will need to send the text like this: "@4474747474747 how are you?" Basically, add a @ symbol before the number of the contact you want to mention.
chat id: xxxxx@c.us
text message
id of message to reply to
Removes all tags within the message
You can optionally add an array of contact IDs to tag only specific people
Sets a chat status to seen. Marks all messages as ack: 3
chat id: xxxxx@c.us
Sends a sticker (including GIF) from a given URL
By default the request is a get request, however you can override that and many other options by sending this parameter. You can read more about this parameter here: https://github.com/axios/axios#request-config
Promise<MessageId | boolean>
Sends a sticker from a given URL
The recipient id.
The url of the image
The id of the message to reply to
By default the request is a get request, however you can override that and many other options by sending this parameter. You can read more about this parameter here: https://github.com/axios/axios#request-config
Promise<MessageId | boolean>
Sends a text message to given chat If you need to send a message to new numbers please see these instructions:
Sends a text message to given chat that includes mentions. In order to use this method correctly you will need to send the text like this: "@4474747474747 how are you?" Basically, add a @ symbol before the number of the contact you want to mention.
chat id: xxxxx@c.us
text message
Removes all tags within the message
You can optionally add an array of contact IDs to tag only specific people
Send VCARD
vcard as a string, you can send multiple contacts vcard also.
The display name for the contact. Ignored on multiple vcards
If supplied, this will be injected into the vcard (VERSION 3 ONLY FROM VCARDJS) with the WA id to make it show up with the correct buttons on WA. The format of this param should be including country code, without any other formating. e.g:
4477777777777
Ignored on multiple vcards
Sends a video to given chat as a gif, with caption or not, using base64
chat id xxxxx@c.us
DataURL data:image/xxx;base64,xxx or the RELATIVE (should start with ./
or ../
) path of the file you want to send. With the latest version, you can now set this to a normal URL (for example [GET] https://file-examples-com.github.io/uploads/2017/10/file_example_JPG_2500kB.jpg
).
string xxxxx
string xxxxx
string true_0000000000@c.us_JHB2HB23HJ4B234HJB to send as a reply to a message
By default the request is a get request, however you can override that and many other options by sending this parameter. You can read more about this parameter here: https://github.com/axios/axios#request-config
Automatically sends a youtube link with the auto generated link preview. You can also add a custom message.
string A youtube link.
string Custom text as body of the message, this needs to include the link or it will be appended after the link.
string Base64 of the jpeg/png which will be used to override the automatically generated thumbnail.
Set the wallpaper background colour
'#FFF123'
Turn the ephemeral setting in a chat to on or off
The ID of the chat
true
to turn on the ephemeral setting to 1 day, false
to turn off the ephemeral setting. Other options: 604800 | 7776000
Promise<boolean>
true if the setting was set, false
if the chat does not exist
Change the group chant description
'0000000000-00000000@g.us' the group id.
string The new group description
boolean true if action completed successfully.
Change who can and cannot edit a groups details
'0000000000-00000000@g.us' the group id.
boolean set to true if you want only admins to be able to speak in this group. false if you want to allow everyone to speak in the group
boolean true if action completed successfully.
Change the icon for the group chat
123123123123_1312313123@g.us The id of the group
boolean true if it was set, false if it didn't work. It usually doesn't work if the image file is too big.
Change the icon for the group chat
123123123123_1312313123@g.us The id of the group
By default the request is a get request, however you can override that and many other options by sending this parameter. You can read more about this parameter here: https://github.com/axios/axios#request-config
boolean true if it was set, false if it didn't work. It usually doesn't work if the image file is too big.
Change the group chat title
'0000000000-00000000@g.us' the group id.
string The new group title
boolean true if action completed successfully.
Change who can and cannot speak in a group
'0000000000-00000000@g.us' the group id.
boolean set to true if you want only admins to be able to speak in this group. false if you want to allow everyone to speak in the group
boolean true if action completed successfully.
Set your profile name
Please note, this does not work on business accounts!
String new name to set for your profile
set your about me
String new profile status
Set presence to available or unavailable.
if true it will set your presence to 'online', false will set to unavailable (i.e no 'online' on recipients' phone);
Sets the profile pic of the host number.
string data url image string.
Promise<boolean>
success if true
Simulate '...recording' in chat
turn on similated recording, false to turn it off you need to manually turn this off.
Simulate '...typing' in chat
turn on similated typing, false to turn it off you need to manually turn this off.
Star a message
Message ID of the message you want to star
true
Syncs contacts with phone. This promise does not resolve so it will instantly return true.
Tags everyone in the group with a message
group chat id: xxxxx@g.us
text message to add under all of the tags
Removes all tags within the message
The formatting of the tags. Use @mention to indicate the actual tag. @default @mention
set to true
to show the message before all of the tags
Promise<MessageId>
Test the button commands on MD accounts with an insiders key. This is a temporary feature to help fix issue #2658
Use this simple command to test firing callback events.
false
if the callback was not registered/does not exist
Unmutes a conversation.
boolean true: worked or error code or message
Unstar a message
Message ID of the message you want to unstar
true
Update registered events for a specific webhook. This will override all existing events. If you'd like to remove all listeners from a webhook, consider using removeWebhook.
In order to update authentication details for a webhook, remove it completely and then reregister it with the correct credentials.
Wait for all queues to be empty
Wait for the webhook queue to become idle. This is useful for ensuring webhooks are cleared before ending a process.
Listens to messages acknowledgement Changes