Open Shajeel-Afzal opened 4 years ago
+1, I'm having the same problem.
But as I'm analyzing, my payload is being nested inside fullfilment.webhookPayload
instead of fulfillment.fulfillmentMessages
, even using the payload flags sendAsMessage
or rawPayload
Check which version of dialogflow-fulfillment
you are using. The inline editor for firebase use version 5.0.0
by default and I noticed a similar behaviour to what is described above with that version, so try changing the version of dialogflow-fulfillment:
In package.json
:
"dialogflow-fulfillment": "^0.5.0"
---> "dialogflow-fulfillment": "^0.6.1"
In
package.json
:"dialogflow-fulfillment": "^0.5.0"
--->"dialogflow-fulfillment": "^0.6.1"
Thanks @HSpens works as expected after update. Just for others who Google the same thing, the code to send custom payload is:
// const { Payload } = require("dialogflow-fulfillment");
const payload = {
key: 'value',
key2: 2
};
agent.add(
new Payload(agent.UNSPECIFIED, payload, {rawPayload: true, sendAsMessage: true})
);
@s22su, does voice also work in case of Custom payload?
@s22su, does voice also work in case of Custom payload?
I don't have an answer to that as I haven't built any bot who answer using voice.
In
package.json
:"dialogflow-fulfillment": "^0.5.0"
--->"dialogflow-fulfillment": "^0.6.1"
Thanks @HSpens works as expected after update. Just for others who Google the same thing, the code to send custom payload is:
// const { Payload } = require("dialogflow-fulfillment"); const payload = { key: 'value', key2: 2 }; agent.add( new Payload(agent.UNSPECIFIED, payload, {rawPayload: true, sendAsMessage: true}) );
God, man I was trying so hard to find a solution and this code resolved my issue. Thanks.
In
package.json
:"dialogflow-fulfillment": "^0.5.0"
--->"dialogflow-fulfillment": "^0.6.1"
Thanks @HSpens works as expected after update. Just for others who Google the same thing, the code to send custom payload is:
// const { Payload } = require("dialogflow-fulfillment"); const payload = { key: 'value', key2: 2 }; agent.add( new Payload(agent.UNSPECIFIED, payload, {rawPayload: true, sendAsMessage: true}) );
Hi, sorry to mention this post as a long time has passed, but I am desperate. I have copied your code, I have upgraded versions and it is still not working, though there is no error message in logs, nothing is showing .......please help me... the JSON that I get as a response is the following:
{ "responseId": "56a0a335-5814-402e-8076-464b37ae6038-266f04e0", "queryResult": { "queryText": "list", "parameters": {}, "allRequiredParamsPresent": true, "fulfillmentMessages": [ { "payload": { "key": "value", "key2": 2 }, "platform": "TELEGRAM" } ], "intent": { "name": "projects/my-best-self-hywkfp/agent/intents/f8edc35d-02b9-41ce-b6a5-166d2655fd89", "displayName": "DisplayList" }, "intentDetectionConfidence": 1, "diagnosticInfo": { "webhook_latency_ms": 421 }, "languageCode": "en" }, "webhookStatus": { "message": "Webhook execution successful" } }
In
package.json
:"dialogflow-fulfillment": "^0.5.0"
--->"dialogflow-fulfillment": "^0.6.1"
Thanks @HSpens works as expected after update. Just for others who Google the same thing, the code to send custom payload is:
// const { Payload } = require("dialogflow-fulfillment"); const payload = { key: 'value', key2: 2 }; agent.add( new Payload(agent.UNSPECIFIED, payload, {rawPayload: true, sendAsMessage: true}) );
What exactly goes in payload
? Like the original question I'm trying to send something like this:
"fulfillmentMessages": [
{
"text": {
"text": [
"First question."
]
}
},
{
"text": {
"text": [
"What is your name?"
]
}
},
"payload": {
"deplay": "13 seconds"
}
]
But I can't seem to get it into that format in a way that works!
In
package.json
:"dialogflow-fulfillment": "^0.5.0"
--->"dialogflow-fulfillment": "^0.6.1"
Thanks @HSpens works as expected after update. Just for others who Google the same thing, the code to send custom payload is:
// const { Payload } = require("dialogflow-fulfillment"); const payload = { key: 'value', key2: 2 }; agent.add( new Payload(agent.UNSPECIFIED, payload, {rawPayload: true, sendAsMessage: true}) );
Hi, sorry to mention this post as a long time has passed, but I am desperate. I have copied your code, I have upgraded versions and it is still not working, though there is no error message in logs, nothing is showing .......please help me... the JSON that I get as a response is the following:
{ "responseId": "56a0a335-5814-402e-8076-464b37ae6038-266f04e0", "queryResult": { "queryText": "list", "parameters": {}, "allRequiredParamsPresent": true, "fulfillmentMessages": [ { "payload": { "key": "value", "key2": 2 }, "platform": "TELEGRAM" } ], "intent": { "name": "projects/my-best-self-hywkfp/agent/intents/f8edc35d-02b9-41ce-b6a5-166d2655fd89", "displayName": "DisplayList" }, "intentDetectionConfidence": 1, "diagnosticInfo": { "webhook_latency_ms": 421 }, "languageCode": "en" }, "webhookStatus": { "message": "Webhook execution successful" } }
try send like this (set rawPayload
to false
):
agent.add( new Payload(agent.TELEGRAM, payload, {rawPayload: false, sendAsMessage: true}) );
Hello, how can I send a voice file using this method?
try send like this (set rawPayload to false): agent.add( new Payload(agent.TELEGRAM, payload, {rawPayload: false, sendAsMessage: true}) );
@Kirigetov , How to set the rawPayload inside the json response which I am sending back to Dialogflow just like @jmodiano
I am trying to send custom payload from the webhook (Firebase Cloud Function) but I am not able to achieve what I am trying. In response I wanna get something like:
But right now I don't know how to add Payload in the fulfillmentMessages Array. My current code is:
I have tried this
But then it does not send fulfillmentMessages array. Any solution?