Dialogflow ES custom events not firing when called - dialogflow-es

I have a Dialogflow ES agent and have set up a custom event up with the agent.
However, when this event is called nothing happens. I know the function that calls it is working as it works when I set the event to the default welcome event.
I added the custom event by just typing the name I wanted for the event in the 'Event' section on Dialogflow ES like this:
The function that is triggering the event is from Voximplant and is set up like this:
dialogflow.sendQuery({ event: { name: "Email", language_code: "en-GB", parameters: { dtmf_digits: toneString } } })
When I change the code to the following to use the default welcome event it all works fine:
dialogflow.sendQuery({ event: { name: "Welcome", language_code: "en-GB", parameters: { dtmf_digits: toneString } } })
Am I setting up the event wrong in Dialogflow? I assumed I could just type the name I wanted for the custom event and start using it in my code.

Solved:
I set the context for the intent I wanted the event to trigger to be the same as the event and this all worked fine.

Related

How to call one intent from another intent in lambda (nodejs)

I have a lex bot which triggers lambda where slot conditions are checked(eg:phone number should be 10 digit) and it returns a closing response of text.
function closeresponse(intent_request, session_attributes, fulfillment_state, message) {
return {
"sessionState": {
"sessionAttributes": session_attributes,
"dialogAction": {
"type": "Close"
},
"intent": {
'name': intent_request[ENTITY.sessionState][ENTITY.intent][ENTITY.name],
'state': fulfillment_state
}
},
"messages": [message],
"sessionId": intent_request["sessionId"],
"requestAttributes": intent_request[ENTITY.requestAttributes] ? intent_request[ENTITY.requestAttributes] : {}
}
}
after closing response i am not able trigger any function
i need to trigger another intent which has yes or no response card in same lambda function
If you want to confirm this intent dialogAction have to be confirmIntent.
If you want to call another intent from this intent the dialogAction have to be elicitIntent.
The dialogAction Close indicates that there will not be a response from the user. In other words, this type doesn't take any further input and will end the entire intent. Therefore, Lex doesn't expect further input from the user.
For your case, you need to accept further input from the user so Close isn't the right dialogAction here. As Jinen said, try changing the dialogAction type to ConfirmIntent or ElicitSlot.
If you need the intent to end after the user responds with yes/no, I think ConfirmIntent is right in line with what you're looking to do. For this one, Lex asks the user a yes or no question on if the intent is complete and ready to be fulfilled.
This piece of documentation explains the different types of dialogAction. It's a useful reference for if you get stuck :)

followupEventInput does not trigger the corresponding intent

The followupEventInput does always trigger the 'default fallback intent'. I have no idea why it doesn't trigger the corresponding intent.
Any help would be appreciated!
my code:
return {
"followup_event_input": {
"name": "example"
}
}
Can you share some details on the two input context , also as you are trying to invoke the intent via custom event , you can remove the input context. If you want to keep the input context make sure that the context are alive before hitting the intent.
Also , were are you referencing this from :return { "followup_event_input": { "name": "example" } }
You can follow this link to get more idea around custom events :Custom Events

How to set dialogflow fulfillment response json context without using webhook client?

I want to create a rich response to Facebook integration using Dialogflow fulfillment. I tried using webhook but it's not working and then I try below way directly using response and now I am facing this context binding issue.
I tried below
let responseJson = {};
let rich = [
{
'text': {
'text': [
text
],
},
'platform': 'FACEBOOK'
},
];
responseJson.fulfillmentMessages = rich;
responseJson.outputContexts = context;
response.json(responseJson);
my context JSON
{ name: 'MAINTENANCE_REQUEST', lifespan: 5, parameters: { maintenanceRequest: maintenanceRequest }}
To add a custom payload without a webhook, go to your intent, and scroll to the bottom where it says "responses". Click on the plus sign (picture) and click on the facebook option. Click on the add responses -> custom payload. The format and available fields for the custom payload are described here. Delete the "Text Response" if it's there so the custom payload will be the only one to be returned.

Suitecommerce Advanced calling a core code's method from a extension

There is a view OrderWizard module view in suitecommerce core code.It has methods similar to below(not the exact code, not pasting for proprietary issues).
I have created the extension and calling OrderWizard's method from the extension.
**setAddr: function(xxx, xxxx) {
this.model.setAddress(xxx, xxxx, xxxx);
return this;
}
renderView: function() {
if (!this.isActiveVal()) {
return this;
}
}**
Extension class:
**define(
'TEST.PaymentValidation.PaymentValidation'
, [
'OrderWizard.xxxxx.xxxxx'
]
, function (
OrderWizardAddress
)
{
'use strict';
return {
mountToApp: function mountToApp (container)
{
_.extend(OrderWizardAddress.prototype,
{
setAddressExt: function setAddressExt() {
{
OrderWizardAddress.prototype.setAddr.apply(this, arguments);
}
}
});
_.extend(OrderWizardAddress.prototype,
{
renderExt: function renderExt() {
{
OrderWizardAddress.prototype.renderView.apply(this, arguments);
}
}
});
OrderWizardAddress.prototype.setAddressExt();
OrderWizardAddress.prototype.renderExt();
}
};
});**
when calling the renderExt method,
Cannot read property 'isActiveVal' of undefined TypeError: Cannot read property 'isActiveVal' of undefined. Eventhough isActiveVal is available in OrderWizard view.
When calling the setAddressExt
I'm getting 'this is undefined'.
Can someone help me what I'm doing wrong here. What is the best way to call the suitecommerce core codes method from the extension.I guess I'm not passing the actual context(.apply(this) of the OrderWizard view.
Figured out the solution.Basically two independent views have to communicate among each other and display the value.
Payment view and Billing view are two different views. Based on the payment method selected, default billing address needs to selected.Used Backbone's event queue aggregator approach to solve this problem. when the payment method is selected, a publisher sends a message to subscriber. If the payments method is Invoice, publisher publishes the message to subscriber which triggers a method to select the default Billing address.
To add new method from the extension, used the javascript prototype and to add codes to the existing method, used the underscore's wrap method

How can i trigger event in onlyoffice

I am using Onlyoffice 5.0.3. I have altered Onlyoffice code for adding new menu under file menu shown in below image
and i have added action script also.
case "approval":{
Common.UI.custom({
closable: false,
title: "Confirm",
msg: "Are you sure, do you want to confirm the Approve",
buttons: ["approve","reject"],
primary: approve,
iconCls:"warn",
callback: _.bind(function (e) {
if(e=="approve"){
// here i want to trigger event which is given in docEditor Api.
}
else{
}
}, this);
})
break;
}
my problem has to trigger an event which is given in docEditor API.
by using Common.Gateway.eventName(); I have triggered event, which is given in docEditorAPI.
There is no way to do it in the current version.
Please contact ONLYOFFICE team directly to discuss all possible ways how this option can be realized.

Resources