dialogflow / dialogflow-fulfillment-nodejs

Dialogflow agent fulfillment library supporting v1&v2, 8 platforms, and text, card, image, suggestion, custom responses
Apache License 2.0
597 stars 282 forks source link

Unknown response type for adding RichResponse #302

Closed RezaRahmati closed 4 years ago

RezaRahmati commented 4 years ago

Hi

I tried to add rich response for telephony, as below.

           const richResponse = {
                platform: 'TELEPHONY',
                telephonyTransferCall: {
                    phoneNumber: `+${matchRoute.transfer_to}`
                }
            };

            agent.add(richResponse);  // agent: dialogflow.WebhookClient

But I get this exception

Unknown response type: "{"platform":"TELEPHONY","telephonyTransferCall":{"phoneNumber":"+xxxx"}}"

How can I solve this?

RezaRahmati commented 4 years ago

In case someone else needed Telephony rich responses, I forked the library and you can use like below

        agent.add(new TelephonySynthesizeSpeech(`Transferring to xxx`));
        //or
        agent.add(new TelephonySynthesizeSpeech(null, `<speak>Transferring to xxx</speak>`));

        agent.add(new TelephonyTransferCall(`xxx`));

https://github.com/RezaRahmati/dialogflow-fulfillment-nodejs