What is an instance?
An instance is a core concept in WhatsApp APIs. It represents a single unit of connection to WhatsApp: think of it as a “client” that talks to WhatsApp on your behalf, letting you send and receive messages, manage contacts, and run other related operations.What does an instance do?
An instance manages the communication between your application and WhatsApp. Its main responsibilities include:- Sending and receiving messages: an instance can send and receive text, images, audio, and other media through the API.
- Webhooks: an instance can also fire webhooks, notifying your application about events such as incoming messages or status changes.
How do instances work?
Each instance is authenticated with a single phone number. Once connected, it keeps an active session with WhatsApp’s servers. That session is what lets the instance send and receive messages in real time.- Authentication: to get started, the instance is authenticated with WhatsApp. This usually means scanning a QR code or using specific credentials.
- Keeping the connection alive: after authentication, the instance holds a persistent connection to WhatsApp. This connection has to stay active for the instance to keep working.
- Interacting with the API: once connected, the instance can interact with WhatsApp to run operations like sending messages, checking contact status, and more.
- Webhooks and events: the instance can be configured to notify your application through webhooks when certain events happen, such as a new incoming message or a change in a contact’s status.