We are doing the FB messenger integration to the api.ai agent. The quick replies are configured in the intent response section as shown below
With webhook is disabled:
The response from api.ai console chat is having "type" and "platform" fields populated as shown below. And, the quick reply is shown properly in FB messenger.
With webhook enabled:
In the webhook service (springboot application having http converter set to gson, spring.http.converters.preferred-json-mapper=gson),
We have created new ReponseMessage class for FB as shown below by setting Platform to FACEBOOK.
`public abstract class FBResponseMessages extends ResponseMessage {
For testing purposes, we had tried to override ResponseMessage class to make type and platform attributes as public.
` @Expose
public final MessageType type;
@Expose
public final Platform platform;`
Now, the type and platform fields are appearing in the reponse json, but with Enum Name instead of the code and the value respectively.
Hi,
We are doing the FB messenger integration to the api.ai agent. The quick replies are configured in the intent response section as shown below
With webhook is disabled: The response from api.ai console chat is having "type" and "platform" fields populated as shown below. And, the quick reply is shown properly in FB messenger.
"fulfillment": { "speech": "test fulfillment", "messages": [ { "type": 2, "platform": "facebook", "title": "proceed?", "replies": [ "yes", "no" ] } ] }
With webhook enabled: In the webhook service (springboot application having http converter set to gson, spring.http.converters.preferred-json-mapper=gson), We have created new ReponseMessage class for FB as shown below by setting Platform to FACEBOOK.
`public abstract class FBResponseMessages extends ResponseMessage {
protected FBResponseMessages(MessageType type) { super(type, Platform.FACEBOOK); } ....... }`
Now, created the QuickReplyReponseMessage and added to the FulFillment messages as shown below.
Fulfillment fulFillment = aiResponse.getResult().getFulfillment(); FBResponseMessages.ResponseQuickReply quickReply = new FBResponseMessages.ResponseQuickReply(); quickReply.setTitle("do you want to proceed?"); quickReply.setReplies("yes","no"); messages.add(quickReply); fulFillment.setMessages(messages); return fulFillment;
The json coming out of this does not have type and platform set because of which the quickreply is not being shown in FB.
{ "speech": "test fulfillment", "messages": [ { "title": "do you want to proceed?", "replies": [ "yes", "no" ] } ], "displayText": "test fulfillment" }
For testing purposes, we had tried to override ResponseMessage class to make type and platform attributes as public. ` @Expose public final MessageType type;
@Expose public final Platform platform;`
Now, the type and platform fields are appearing in the reponse json, but with Enum Name instead of the code and the value respectively.
{ "speech": "test fulfillment", "messages": [ { "title": "do you want to proceed?", "replies": [ "yes", "no" ], "type": "QUICK_REPLY", "platform": "FACEBOOK" } ], "displayText": "test fulfillment" }
Can somebody suggest whether there is anything wrong with the way we are doing or problem with the code?