mohammad obaid
mohammad obaid

Reputation: 413

sending dialogflow card to whatsapp via twilio failed

I am trying to build whatsapp chatbot using Dialogflow and twilio . I notice that only text message are successfully send from twilio .

When I tried to send Dialogflow card , twilio throws an error There was a failure attempting to retrieve the contents of this URL. . I am sending card using cloud function from Dialogfunction inline editor as follows

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");
    }

  }

Although this works perfectly in Dialogflow but unable to receive it on whatsapp. Only text messages are working .

Is it because I am currently on twilio sandbox or they do not support messages with images?

Upvotes: 0

Views: 237

Answers (1)

Ali Hasnain
Ali Hasnain

Reputation: 210

WhatsApp does not support Cards at this moment. So twilio throws this type of error.

Upvotes: 1

Related Questions