Send WhatsApp replies depending on the keywords to specific agents in Slack with n8n

With the power of n8n, streamline your communication process by automatically sending WhatsApp replies based on keywords to specific agents in Slack. Automate WhatsApp Replies to Specific Slack Agents with n8n, making your messaging workflow more efficient than ever

The goal of this process is to automate responses to common inquiries or requests received via WhatsApp by analyzing the content for keywords and responding accordingly. At the same time, the system ensures that a human agent is made aware of the interaction, in case further assistance or follow-up is required. This kind of automation can be useful in customer service, support, or other scenarios where rapid responses are needed.


This guide involves automating responses to incoming WhatsApp messages by identifying specific keywords within those messages and sending appropriate replies. Additionally, it includes notifying an agent through the Slack messaging platform about the received request. Here’s a step-by-step explanation:

  1. Receive WhatsApp Messages
  • You will be able to set up a system to monitor incoming WhatsApp messages.

2. Keyword Detection

  • Your system will analyze the content of each incoming message to identify specific keywords. Keywords are specific words or phrases that are relevant to the request or conversation.

3. Generate Replies

  • Based on the keywords detected in the incoming message, your system will have predefined responses or actions associated with those keywords. These responses could be pre-written text messages, links, images, or even automated actions, depending on the context.

4. Send WhatsApp Replies:

  • Once the appropriate response is determined, your system will send a reply to the sender of the WhatsApp message. The reply will be tailored to the specific keywords found in the original message.

5. Notification on Slack

  • After sending the WhatsApp reply, your system will then send a notification to an agent through the Slack messaging platform. This notification serves to inform the agent that a request has been received and responded to on WhatsApp.


1. Click on Workflows…

Connecting Slack with WhatsApp

2. Click on Add Workflow

Slack WhatsApp integration

3. Click on Add first step…

WhatsApp Slack integration

4. Type “Webhook”

Slack and WhatsApp integration

5. Click on Webhook

WhatsApp and Slack integration

6. Check the Parameters of your Webhook.

Synchronizing Slack with WhatsApp

7. Click on the small plus icon beside Webhook to add a new node.

How to integrate Slack and WhatsApp

8. Type “Switch”

Synchronizing Slack with WhatsApp

9. Click on “Switch”

The “Switch” is a conditional branching node that will allow you to route your workflow in different directions based on specific conditions. It’s a fundamental element for creating logic in your workflows.Click on "Switch"

10. A new window will open allowing you to view and edit the parameters of your Switch.

Slack and WhatsApp integration

11. Under “Data type” select String.

WhatsApp Slack integration

12. Under Value 1, click on “Expression” and enter your Variable from Webhook.

Expressions are like magic commands that help you change and work with your data in your workflows. You can use them to create new data, pick out specific pieces of information, do math, and lots of other things.

These expressions are most often used in special places in your workflow, like when you want to change data in a “Set” step or make decisions in a “Conditional” step. It’s like having a toolkit to make your data do exactly what you want.Slack WhatsApp integration

13. Click on Add Routing Rule

Connecting Slack with WhatsApp

14. Under “Operator” select “Contains”.

Under "Operator" select "Contains".

15. Under Value 2, you may enter whichever phrase or value you prefer.

Here we are setting up a dedicated route for the “Sample 1” messages and configure an HTTP module to send a specific message related to that keyword using the specified parameters. This helps ensure that messages related to this keyword are processed correctly and can trigger the appropriate actions or responses.

“Output” is the index of output to which to send data to if rule matches.WhatsApp Slack integration

16. Next off, you may add a new routing rule by clicking on the Add Routing Rule button. You may proceed by doing the same configurations above with different phrases/data.

Next off, you may add a new routing rule by clicking on the Add Routing Rule button. You may proceed by doing the same configurations above with different phrases/data.

17. Under “Operator” select “Contains”.

WhatsApp and Slack integration

18. Under Value 2, you may enter again whichever phrase or value you prefer.

Synchronizing Slack with WhatsApp

19. Type “1”

How to integrate Slack and WhatsApp

20. Review the Parameters of your Switch before leaving this node.

Synchronizing Slack with WhatsApp

21. You may also click on Execute node to test out the node.

WhatsApp and Slack integration

22. A switch has now been added on your Canvas.

Slack and WhatsApp integration

23. Next off we’ll add some HTTP Request. You can do this by clicking again on the plus icon next to “Switch”.

The “HTTP Request” node in n8n is a key component for enabling your workflows to interact with external web services and APIs. It allows you to exchange data and perform actions with other online systems, making it a powerful tool for automation and integration.WhatsApp Slack integration

24. Type “HTTP Request”

Slack WhatsApp integration

25. Click on HTTP Request

Connecting Slack with WhatsApp

26. Under “Method” select “Post”

Slack WhatsApp integration

27. Click on “POST”

WhatsApp Slack integration

28. Under URL, click on “Expression” and enter the variable from Webhook/URL to make the request to.

Under URL, click on "Expression" and enter the variable from Webhook/URL to make the request to.

29. Click on Back to canvas…

WhatsApp and Slack integration

30. Toggle the “Sample Header” button and proceed under “Name” and enter your desired Name for your header.

Synchronizing Slack with WhatsApp

31. Under “Value” enter your desired value.

How to integrate Slack and WhatsApp

32. Click on Back to canvas…

Synchronizing Slack with WhatsApp

33. Once done, you may try out this node by clicking on the “Execute node” button.

WhatsApp and Slack integration

34. You may proceed and duplicate this HTTP Request for multiple routing path/configurations, depending on the routing path from your Switch.

Don’t forget to edit any field within your node that are necessary!Slack and WhatsApp integration

35. You can see multiple HTTP Request here as an example.

WhatsApp Slack integration

36. Next off, we’ll integrate Slack to our canvas. We can do this by clicking on the plus icon beside HTTP Request.

Slack and WhatsApp integration

37. Under the “What happens next? window”, type “Slack”.

WhatsApp and Slack integration

38. Click on Slack

Click on Slack

39. Through this you may send a slack notification to a user in a team

How to integrate Slack and WhatsApp

40. Map the fields to send a slack notification to a user in a team

Synchronizing Slack with WhatsApp

41. Your canvas should now be almost complete.

You may also rename the HTTP Request and Slack nodes to your desired names. This way, you won’t interchange any data and properly identify what goes on your workflow.WhatsApp and Slack integration

42. You’ll have to connect the HTTP Request to the Slack node. You can do the by dragging the circular icon from the HTTP request to the bar icon on the left of your Slack node.

Slack and WhatsApp integration

43. To rename the nodes, click on the node you’d like to rename.

WhatsApp Slack integration

44. You should see a pen/pencil icon beside the current title of the node. Clicking on that icon will allow you to rename the node.

How to integrate Slack and WhatsApp

45. Type in any phrase you’d like to rename the node to. Here, I used “Whatsapp: Send Sample Header” as an example.

Synchronizing Slack with WhatsApp

46. Click on Rename

Slack and WhatsApp integration

47. Click on Back to canvas…

Click on Back to canvas…

48. Same step for the Slack node. Here I used “Notify Agent 3 about new message” for my Slack node’s name.

Slack WhatsApp integration

49. Click on Rename

Connecting Slack with WhatsApp

50. Click on Back to canvas…

Slack WhatsApp integration

51. You may do this to all applicable nodes on your workflows.

Synchronizing Slack with WhatsApp

Table of Contents

Omnichannel Automation Platform

TimelinesAI helps businesses with multiple individual numbers gain 360° visibility & boost performance on WhatsApp.

ajkasjdlaspng

Latest from Blog