Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with my Agent when Integrated with Twilio for WhatsApp #144

Open
alawibh opened this issue Aug 7, 2021 · 1 comment
Open

Problem with my Agent when Integrated with Twilio for WhatsApp #144

alawibh opened this issue Aug 7, 2021 · 1 comment

Comments

@alawibh
Copy link

alawibh commented Aug 7, 2021

Hello Everyone,

Since one week I'm trying to integrate Dialogflow with Twilio for WhatsApp messaging.

The integration has been configured successfully, but I'm facing strange error when retrieving our products through HTTP request using Axios.

Test code is here:

function testLoopReply(agent) {
   const category_name = 'Small%20Appliances';  
   return new Promise((resolve, reject) => {
       axios.get(`https://sheetdb.io/api/v1/qvlk728a5p23g/search?Categories=*${category_name}*&Status=1&limit=1`).then(function (res) {
           let Categories = res.data;
           if (Categories) {                
                 for (const product of Categories ){
                    agent.add(`https://alaswadtrading.com/index.php?route=product/product&product_id=${product.ProductID}\n\n${product.Name}`);
                }
           } else {
                agent.add(`No items found in the selected category (${category_name})`);
           }

           resolve();
       });
   }); 
  }

Consider scenario No. 1:

  • Set (Category_Name = “Cooking”), the webhook response have multiple text responses:
{
  "fulfillmentMessages": [
    {
      "text": {
        "text": [
          "https://alaswadtrading.com/index.php?route=product/product&product_id=2\n\nBEKO STANDARD COOKER HOOD 60CM - INOX"
        ]
      }
    },
    ...
    {
      "text": {
        "text": [
          "https://alaswadtrading.com/index.php?route=product/product&product_id=44\n\nBEKO GAS COOKER 90X60 CLOSE DOOR"
        ]
      }
    }
  ],
  "outputContexts": []
}

In this scenario, the agent reply with those multiple results normally as per attached snapshot:

Test-With-Cooking

But Twilio does not respond and an error 11200 triggered as per attached snapshots:

Test-With-Cooking-Twilio

Test-With-Cooking-Twilio-Error-Message

Now, consider scenario No. 2

  • Set (Category_Name = “Small%20Appliances”), the webhook response have multiple text responses:
{
  "fulfillmentText": "https://alaswadtrading.com/index.php?route=product/product&product_id=1\n\nBEKO TURKISH COFFEE MACHINE SINGLE CUP SKY BLUE",
  "outputContexts": []
}

In this scenario, the agent reply with the results normally as per attached snapshot:

Test-With-Small

Also, Twilio worked fine and respond normally as per attached snapshot:

Test-With-Small-Twilio

I have contacted Dialogflow and Twilio but with no luck to find a solutions, and here their reply:

Twilio-Support-1

Twilio-Support-2

I'm not sure what is the problem and how I can figure it out in order to publish our agent.

Kindly, advice?

@CRISTIANLOPEZ16
Copy link

hi, were you able to resolve the error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants