Skip to content

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 account ID in your personal account. 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.

login-slack

How to create a workspace?
  1. Click on the Create a new workspace button.
  2. On the new page, click on the Create a workspace button.

workspace

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 the Next button.

    company-name

  • In the What's your name? field, enter your account name, and you can also change your account's photo if desired. Then click the Next button.

    personal-name

  • 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 the Copy Invite Link button. Then click Next, or you can skip adding users by clicking the Skip this step button.

    add-coworker

  • In the What's your team working on right now? field, enter the name of the public channel. Then click Next.

    channel-name

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

    permission

  • You can check the availability of the application in the Apps section

    check-app

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 your personal account and click the Create an instance button. For testing purposes, select the "Developer" plan.

create-instance

developer

  • 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.

    scan-qr

    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.

    scan-qr

After successful authorization, in Your profile 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 the GetStateInstance method.

  • Copy the values of idInstance and apiTokenInstance, these values are needed to configure the instance to work with Slack

console

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.

show-users

In the user view window, go to integrations by clicking the Integrations button.

go-to-integrations

  • Click the Add an App button to access the list of available applications.

    add-an-app

  • Click the Add button next to the Green API application in the In your workspace list.

    add-green-api

added

Done! The application has been added to the channel!

The procedure for configuring the Application in the Channel:#

  • Type '/' or click the comands button to display a list of commands.

commands-api

  • Enter /greenapi add "idInstance" and "apiTokenInstance"to add an instance to the channel. Replace idInstance and apiTokenInstance 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 your Green API personal account
  • Go to the instance settings by clicking on the desired instance from the list
  • Copy the values of idInstance and apiTokenInstance

You can also paste the copied values from the "Setting up the Green API application" section

add-instance

  • If the instance is successfully added, you will receive a message from the bot: The instance has been successfully added.

success-add

  • Enter /greenapi start "idInstance" to start receiving WhatsApp messages.

start-instance

  • 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.

example-incoming-message

incoming-message

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 threads button or reply, to open the thread (chat)

create-message

  • In the opened thread (chat), compose your message and click the send send button.

sending-message

Done! You have sent a message!

Message Examples#

  • Message Examples in Slack

    example-1

  • Message Examples in WhatsApp

    example-en

Done! You can now send and receive messages through Slack!