GoogleCloudPlatform / GoogleCloudPlatform/dialogflow-integrations

Problem with my Agent when Integrated with Twilio for WhatsApp

Open
#144 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
286
Forks
547
PR merge metrics
No merged PRs in 30d

Description

**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](https://user-images.githubusercontent.com/5417655/128585053-129f8edf-3ea6-4970-9a7f-8444002accf9.jpg)

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

![Test-With-Cooking-Twilio](https://user-images.githubusercontent.com/5417655/128585134-9df1888d-6dcf-42f0-9d72-de1f959228fb.jpg)

![Test-With-Cooking-Twilio-Error-Message](https://user-images.githubusercontent.com/5417655/128585143-fa43be6d-bdf9-4a48-b066-ef7ac9422566.jpg)

**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](https://user-images.githubusercontent.com/5417655/128585217-57150b5f-9527-4dd0-ad3d-21c61bd772b8.jpg)

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

![Test-With-Small-Twilio](https://user-images.githubusercontent.com/5417655/128585248-acc2a7d5-8b5e-424c-b998-6b57e6fdc2b6.jpg)

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

![Twilio-Support-1](https://user-images.githubusercontent.com/5417655/128585346-e8c92442-a34e-42fc-a541-4082609283ee.jpg)

![Twilio-Support-2](https://user-images.githubusercontent.com/5417655/128585372-91ddfb31-f3f5-45fb-bb92-c2836a396291.jpg)

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

Kindly, advice?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.