How to use Green-API chats via a link?#
Green-API provides a convenient tool for viewing and interacting with WhatsApp account Chats in your console.
This Chat allows you to monitor the correctness of mailings in real time and track incoming messages within green-api console.
However, it is even more convenient when these chats are built directly into your system or integration.
This is especially relevant in the following cases:
- Managers need to quickly respond to customer messages without switching between windows;
- CRM systems need to centralize communication and correspondence history;
- Support services need to quickly process user requests.
Benefits of the built-in chat#
By embedding the Green-API chat using a link, you get:
- The ability to open correspondence without exiting the current system — be it a CRM, web application or internal panel;
- Instant access to the chat without authorization in your console;
- Single interface for working with messages, which simplifies processes and reduces the time for processing requests;
- Flexibility in use — the link can be inserted anywhere: in an iframe, button, pop-up, etc.
Link format#
The basic link format looks like this:
https://chats.green-api.com/?idInstance={{idInstance}}&apiTokenInstance={{apiTokenInstance}}&apiUrl={{apiUrl}}&mediaUrl={{mediaUrl}}
Link parameters#
Parameter | Description |
---|---|
idInstance | Instance ID located in the Green-API console |
apiTokenInstance | API token, which is also located in the console |
apiUrl | Link to the API host (used to interact with the API) |
mediaUrl | Link to the host for sending files (media messages) |
All the necessary parameters can be found in the Green-API console:
- Go to the "Instances" section.
- Select the desired instance.
-
Copy:
idInstance
apiTokenInstance
apiUrl
(e.g.https://api.green-api.com
)mediaUrl
(e.g.https://media.green-api.com
)
Example of a working link#
Below is an example of a link that has already been generated with parameters filled in:
https://chats.green-api.com/?idInstance=12345678&apiTokenInstance=719e2cde183280a9e1fc6c6b3f370007d&apiUrl=https://api.green-api.com&mediaUrl=https://media.green-api.com
By opening this link in a browser, you will be taken to the chat interface associated with the specified instance.
Integration into a project#
You can use this link:
- In buttons on the site (for example, "Open chat");
- In an iframe to display the chat inside a web application;
Example of a button in HTML:
```html
<a href="https://chats.green-api.com/?idInstance=12345678&apiTokenInstance=719e2cde183280a9e1fc6c6b3f370007d&apiUrl=https://api.green-api.com&mediaUrl=https://media.green-api.com" target="_blank">
Open WhatsApp chat
</a>
Embedding Green-API chats using a link is a quick and effective way to organize communication with clients. All you need is to correctly substitute the parameters from your console and use the received link in your project.