Integration setup#
Slack is a messaging application designed for business communication, providing people with access to the information they need.
The platform Green-API has its own application in the Slack service, with which you can send Whatsapp messages.
To use the Green API application, you need to get a registration token and an instance ID in console. To test our API, we recommend using the free developer plan.
Integration Setup Procedure:
1. Setting up the Slack application
2. Setting up the Green API application
3. Receiving a message
4. Sending a message
1. Setting up the Slack application#
- Log in or create a new workspace in Slack.
How to create a workspace?
- Click on the
Create a new workspace
button. - On the new page, click on the
Create a workspace
button.
Slack will create a new workspace where you'll need to configure the name, users, and channels. Here's the setup process:
-
In the
What's the name of your company or team?
field, enter the name of your workspace and click theNext
button.
-
In the
What's your name?
field, enter your account name, and you can also change your account's photo if desired. Then click theNext
button.
-
In the
Who else is on the 'Name' team?
field, you can add other users or colleagues by email. You can also copy the invitation link by clicking theCopy Invite Link
button. Then clickNext
, or you can skip adding users by clicking theSkip this step
button. -
In the
What's your team working on right now?
field, enter the name of the public channel. Then clickNext
.
Done! Your workspace is ready to use!"
- Add the Green API application to your workspace by following this link.
-
Select the workspace where you want to install the Green API application and click the
Allow
button to grant permission for its usage -
You can check the availability of the application in the
Apps
section
2. Setting up the Green API application#
- Log in or register an account on Green API.
- Create an instance on the free "Developer" plan. To do this, go to console and click the
Create an instance
button. For testing purposes, select the "Developer" plan.
-
Authorize the phone. To do this:
You can scan the QR code on the instance setup page. In the WhatsApp mobile app or WhatsApp Business, log in to the linked devices and scan the QR code received.
Or request a six-digit authorization code to be bound by phone number. In the WhatsApp mobile app or WhatsApp Business, log in to linked devices and tap
Link with phone number instead
.
After successful authorization, in console the instance should have the status
Authorized
(The status cannot always change automatically; if necessary, you need to refresh the page).
You can check the status of the instance using theGetStateInstance
method.
- Copy the values of
idInstance
andapiTokenInstance
, these values are needed to configure the instance to work with Slack
3. Receiving a message#
To receive messages in Slack, you need to configure the Green API application in the channel.
Important
When using the Green API application in Slack, you cannot initiate a conversation; you must receive an incoming message to which you can respond.
The procedure for adding an application to a channel:#
- Select the channel where you will receive and send messages.
- In the channel, click on the user view button.
In the user view window, go to integrations by clicking the Integrations
button.
-
Click the
Add an App
button to access the list of available applications. -
Click the
Add
button next to the Green API application in theIn your workspace
list.
Done! The application has been added to the channel!
The procedure for configuring the Application in the Channel:#
- Type '/' or click the button to display a list of commands.
- Enter
/greenapi add "idInstance" and "apiTokenInstance"
to add an instance to the channel. ReplaceidInstance
andapiTokenInstance
with the values of your instance (Message receiving will be from the number associated with this instance).
Instance Values of idInstance and apiTokenInstance
- Log in to Green API console
- Go to the instance settings by clicking on the desired instance from the list
- Copy the values of
idInstance
andapiTokenInstance
You can also paste the copied values from the "Setting up the Green API application" section
- If the instance is successfully added, you will receive a message from the bot:
The instance has been successfully added.
- Enter
/greenapi start "idInstance"
to start receiving WhatsApp messages.
- If message receiving starts successfully, you will receive a message from the bot in the channel:
Started receiving incoming notifications
.
Instance settings
Upon successful message reception initiation, the instance setting is automatically configured:
"webhookUrl": "https://slack.greenapi.com/webhook",
"webhookUrlToken": "1dc99fe0bdb93c0a...............................................",
"incomingWebhook": "yes"
Settings may take up to 5 minutes. At this moment you will not receive messages.
- Example of an incoming message:
When receiving an incoming message, the bot forms a thread (chat) indicating the phone number, sender's name, and instance number. To view the incoming message, click
reply
.
Attention
To check, you need to send a message to the number connected to your instance.
4. Sending a message#
To send a message in Slack, you need to receive an incoming message to which you can reply.
- Click the threads button or
reply
, to open the thread (chat)
- In the opened thread (chat), compose your message and click the send button.
Done! You have sent a message!
Message Examples#
-
Message Examples in Slack
-
Message Examples in WhatsApp
Done! You can now send and receive messages through Slack!