Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

custom payload not rendering in fulfillment message #4

Open
Sarps opened this issue Aug 11, 2018 · 7 comments
Open

custom payload not rendering in fulfillment message #4

Sarps opened this issue Aug 11, 2018 · 7 comments

Comments

@Sarps
Copy link

Sarps commented Aug 11, 2018

When I create a custom payload programmatically and render it, it ends up being outside of the fulfillmentMessages array.

$this->agent->reply(\Dialogflow\RichMessage\Payload::create([
            "type" => "web_url",
            "url" => "There are 24 shops in Lisda.",
            "title" => "http://localhost:8000/maps",
 ]));
{"payload":{"unspecified":{"type":"web_url","url":"http:\/\/localhost:8000\/maps","title":"Click to view map."}},"fulfillmentMessages":[{"text":{"text":["There are 24 shops in Lisda."]}}],"fulfillmentText":"There are 24 shops in Lisda.","outputContexts":[]}

Due to that dialogflow places the payload in data object instead of messages object.

{"speech":"There are 24 shops in Lisda.","source":"","messages":[{"type":0,"speech":"There are 24 shops in Lisda."}],"data":{"unspecified":{"type":"web_url","title":"Click to view map.","url":"http://localhost:8000/maps"}}}

Which is not what I get when I add the payload manually to the intent response inside dialogflow.

"fulfillment":{"messages": [{"type":"custom_payload","platform":"google","payload":{"unspecified":{...}}},,{"type":4,"payload":{"unspecified":{"type":"web_url","url":"http://localhost:8000/maps","title":"Click to view map."}}}], "speech":""}

Please is there any way that I could force the payload into the fulfillmentMessages array.
Thank you for your good works. This package has really helped a lot.

@eristemena
Copy link
Owner

eristemena commented Aug 11, 2018

What is the request source you're getting?

Currently custom payload only supports the following request source: "google", "facebook", "kik", "line", "skype", "slack", "telegram", "viber". Other than that the key will be set to "unspecified". That seems what happened with yours.

Furthermore, when you're integrating with certain platform, don't preview them in Dialogflow console, cause it will also set the key to "unspecified".

@Sarps
Copy link
Author

Sarps commented Aug 11, 2018

Thanks for the quick response. I am not worried about the key, I can handle that as I am using a nodejs client. My issue is that the payload is outside the fulfillmentMessages array.
Just like how the text response is inside fulfillmentMessages, I was hoping the payload would also be in there, considering the fact that it is a reponse and all responses are supposed to be in the fulfillmentMessages array.
Thanks, once again.

@eristemena
Copy link
Owner

Oh sorry, are you talking about payload object inside fulfillmentMessages as per Dialogflow specification here?

@Sarps
Copy link
Author

Sarps commented Aug 11, 2018

yh, exactly

@eristemena
Copy link
Owner

eristemena commented Aug 11, 2018

I can't reproduce the JSON response you mentioned in the first comment, either by adding it manually using DIalogflow console or using Dialogflow official NodeJS library.

Can you explain more what is the use case here? And what is web_url type? is it a Facebook messaging template? if so, why does your JSON contain google in the platform?

@isbkch
Copy link

isbkch commented Oct 27, 2018

@Sarps I'm getting a similar issue, have you been able to fix yours ?

@basiteaal
Copy link

I think this issue should be closed due to inactivity.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants