通过twilio将dialogflow卡发送到whatsapp失败

时间:2019-10-22 13:37:28

标签: twilio

我正在尝试使用Dialogflow和twilio构建whatsapp聊天机器人。我注意到只有文本消息可以从twilio成功发送。

当我尝试发送Dialogflow卡时,twilio引发错误There was a failure attempting to retrieve the contents of this URL.。我正在使用Dialogfunction内联编辑器中的cloud功能发送卡片,如下所示

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 个答案:

答案 0 :(得分:1)

WhatsApp目前不支持卡。因此,twilio会引发此类错误。