Skip to content

Setting up n8n and WhatsApp integration#

The GREEN-API platform has its own app on the n8n service. We currently recommend using a local installation of n8n.

Integration setup procedure:

  1. Installing nodejs
  2. Installing ngrok
  3. Creating an instance in GREEN-API
  4. Installing the GREEN-API community node
  5. Examples of using the GREEN-API application

1. Installing nodejs#

  1. Download and install Node.js LTS
  2. Verify successful installation by typing node -v in the command line
  3. Install n8n by typing npm install n8n -g in the command line
  4. Run n8n by typing n8n in the command line
  5. The console will be accessible at https://localhost:5678

2. Installing ngrok#

For the webhook server to work, it must be accessible from the outside. To do this, install ngrok or an equivalent.

  1. Download and install ngrok
  2. Run ngrok – in the command line, type ngrok http 5678
  3. The network server address will be obtained:
    • You can create a .env file with the parameter WEBHOOK_URL={received address}
    • You can run n8n with the command set WEBHOOK_URL={received address}&& n8n start

3. Creating an instance in GREEN-API#

To use the GREEN-API application, you need to obtain a registration token and instance ID in console. For testing, we recommend using the free developer plan.

  1. Log in or register for an account with GREEN-API
  2. Create an instance on the free "Developer" plan. To do this, in console, click the Create instance button and select a plan

    create-instance

    developer

  3. Authorize the instance. To do this:

    • You can scan the QR code on the instance setup page.
      In the WhatsApp or WhatsApp Business mobile app, sign in to your linked devices and scan the QR code you receive.

      scan-qr

    • Or request a six-digit authorization code to link by phone number. In the WhatsApp or WhatsApp Business mobile app, go to linked devices and tap 'Link by phone number'.

      scan-qr

    After successful authorization, the instance should receive the 'Authorized' status. You can check the instance status using the method GetStateInstance

  4. Copy the idInstance and apiTokenInstance values for further use with n8n

    console

4. Installing the GREEN-API community node#

Go to the n8n page at https://localhost:5678.

  • Click on the three dots

    go-to-scenarios

  • Select Settings

  • Click on the menu item Community nodes

    go-to-scenarios

  • Install @green-api/n8n-nodes-whatsapp-greenapi

  • Select the items as shown in the screenshot and click the 'Install' button

    go-to-scenarios


Examples of using the GREEN-API application#

How to Create a WhatsApp Echo Bot Using the Green API in n8n