vasani-arpit / WBOT

A simple Web based BOT for WhatsApp™ in NodeJS 😜. Working as of 📅 Feb 4th, 2024
Other
989 stars 314 forks source link

Next Update Request: Match at least 2 words #340

Open arifemreeryilmaz opened 1 year ago

arifemreeryilmaz commented 1 year ago

In an unread message, if 2 or more words that I have pre-determined match, I want to create an appropriate response.

Example: 1- When the word "hello" is used in a sentence, I created an answer as "hello to you too".

2- When the word "cargo" is used in a sentence, I created an answer as "you can track your cargo on our website".

In this case, when I receive a message like the one below, there is a lack of addressing my customer. If the customer writes "Hello, how can I track my shipment?, the bot will simply reply "Hello to you too" or "You can track your shipment on our website".

However, I would like the words "hello" and "cargo" to be matched, and then to respond as "Hello to you too, you can track your cargo on our website". How can I determine the answer given when 2 or more words match?

vasani-arpit commented 1 year ago
        {
            "contains": ["cargo","shipment","track"],
            "exact": [],
            "response": "check this URL.... "
        }

contains block takes multiple words any of the one word is matched then it will reply with response block.

ideally if there are multiple matches bot should reply with both possible responses. but I need to test/confirm that.