当前位置: 首页 > 知识库问答 >
问题:

通过twilio向whatsapp发送dialogflow卡失败

龚永新
2023-03-14

我试图使用Dialogflow和twilio构建whatsapp聊天机器人。我注意到只有短信从twilio成功发送。

当我试图发送Dialogflow card时,twilio抛出一个错误试图检索此URL的内容时失败。。我从Dialogfunction内联编辑器中使用云函数发送卡片如下

function showuseroption(agent){

    var useroption = agent.parameters.number;
    if (useroption == 2){
        agent.add(new Card({
            title: 'Cheese Burger with ABC sauce',
            text: 'Special burger for special people . Buy 1 get 1',
            imageUrl: 'https://res.cloudinary.com/foodoplanet/image/upload/v1562360747/45643836_295063681119603_6598393926548193280_n_jfbsrd.png',
            buttonText: 'Order Now',
            buttonUrl: 'https://google.com'
        }));
      agent.add(new Card({
            title: 'Cheese Burger with BC sauce',
            text: 'Special burger for special people . Buy 1 get 1',
            imageUrl: 'https://res.cloudinary.com/foodoplanet/image/upload/v1562360747/45643836_295063681119603_6598393926548193280_n_jfbsrd.png',
            buttonText: 'Order Now',
            buttonUrl: 'https://google.com'
        }));

      agent.add(new Card({
            title: 'Cheese Burger with AC sauce',
            text: 'Special burger for special people . Buy 2 burgers 2 drinks',
            imageUrl: 'https://res.cloudinary.com/foodoplanet/image/upload/v1562360747/45643836_295063681119603_6598393926548193280_n_jfbsrd.png',
            buttonText: 'Order Now',
            buttonUrl: 'https://google.com'
        }));


    }

    if (useroption == 1)
    {
      agent.add("We will take your order");
    }

    else if(useroption > 2) {
    agent.add("you have selected wrong option");
    }

  }

虽然这在Dialogflow中工作得很好,但在WhatsApp上无法接收。只有短信在起作用。

是因为我目前在twilio沙箱还是他们不支持带有图像的消息?

共有1个答案

夹谷英杰
2023-03-14

WhatsApp目前不支持卡片。所以twilio抛出了这种类型的错误。

 类似资料: