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:
- 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…
2. Click on Add Workflow
3. Click on Add first step…
4. Type “Webhook”
5. Click on Webhook
6. Check the Parameters of your Webhook.
7. Click on the small plus icon beside Webhook to add a new node.
8. Type “Switch”
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.
10. A new window will open allowing you to view and edit the parameters of your Switch.
11. Under “Data type” select String.
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.
13. Click on Add Routing Rule
14. 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.
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.
17. Under “Operator” select “Contains”.
18. Under Value 2, you may enter again whichever phrase or value you prefer.
19. Type “1”
20. Review the Parameters of your Switch before leaving this node.
21. You may also click on Execute node to test out the node.
22. A switch has now been added on your Canvas.
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.
24. Type “HTTP Request”
25. Click on HTTP Request
26. Under “Method” select “Post”
27. Click on “POST”
28. Under URL, click on “Expression” and enter the variable from Webhook/URL to make the request to.
29. Click on Back to canvas…
30. Toggle the “Sample Header” button and proceed under “Name” and enter your desired Name for your header.
31. Under “Value” enter your desired value.
32. Click on Back to canvas…
33. Once done, you may try out this node by clicking on the “Execute node” button.
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!
35. You can see multiple HTTP Request here as an example.
36. Next off, we’ll integrate Slack to our canvas. We can do this by clicking on the plus icon beside HTTP Request.
37. Under the “What happens next? window”, type “Slack”.
38. Click on Slack
39. Through this you may send a slack notification to a user in a team
40. Map the fields to send a slack notification to a user in a team
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.
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.
43. To rename the nodes, click on the node you’d like to rename.
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.
45. Type in any phrase you’d like to rename the node to. Here, I used “Whatsapp: Send Sample Header” as an example.
46. Click on Rename
47. 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.
49. Click on Rename
50. Click on Back to canvas…
51. You may do this to all applicable nodes on your workflows.
- Using WhatsApp in Education: A Thorough Overview - November 28, 2023
- Guide to Recruiting on WhatsApp: A Comprehensive Overview - November 27, 2023
- ActiveCampaign and WhatsApp Integration Playbook - November 24, 2023