Coder Social home page Coder Social logo

Comments (25)

Iridio avatar Iridio commented on May 30, 2024 9

At the moment I do the following:

const response = {
    followupEvent: {
        name: "MyEventName",
        data: { value1: "asd", value2: "qwe" }
    }
}
return myDialogflowApp.response_.status(200).send(response);

It's dirty, but it works and while waiting for approval and eventual publish I think is better than nothing

from actions-on-google-nodejs.

jneveux avatar jneveux commented on May 30, 2024 8

@malikasinger1

I could not find anything in the documentation. I found a function in v2 code conv.js

// See followup(event, parameters, lang).
    conv.followup(eventName);

from actions-on-google-nodejs.

mymro avatar mymro commented on May 30, 2024 7

Well there is a pull request adding this(it works), however the person posting it, has yet to sign the CLA

from actions-on-google-nodejs.

stolkchris avatar stolkchris commented on May 30, 2024 4

For those who stumble on this issue looking for the followup function, It's there. Typehint the conversation object as type DialogflowConversation in the conversation handler.
See the docs

from actions-on-google-nodejs.

HerrHansen avatar HerrHansen commented on May 30, 2024 3

Very hard to find. Cost me two days to find this hint. Thank you so much wubbajack!!

+1 for conv.followup()

https://actions-on-google.github.io/actions-on-google-nodejs/classes/dialogflow.dialogflowconversation.html

Google should update their documentation on dialogflow.com, to help everyone with that issue. And maybe create an example for actions-on-google V2 API. :-)

from actions-on-google-nodejs.

Iridio avatar Iridio commented on May 30, 2024 2

The only thing I can think of, is that you did not create an intnet with the event you want to be activated by the followupEvent command.

from actions-on-google-nodejs.

MizziM96 avatar MizziM96 commented on May 30, 2024 1

Hi, I am trying to use the followupEvent by building the JSON response as shown in previous comments but I still cannot trigger the event I want. I get an input.unknown as a result. I have done nothing on the dialogflow side just normal intents with no input/output contexts and both intents are set to use the webhook. Can someone tell me if I have to set up the intents from the dialogflow side to be triggered or any other step that I might have missed? thanks :)

from actions-on-google-nodejs.

DerGuteWolf avatar DerGuteWolf commented on May 30, 2024

I second this request, I am missing this badly!

from actions-on-google-nodejs.

roschler avatar roschler commented on May 30, 2024

I third it!

Also, something that would allow us to send an E-mail to the user on behalf of our app? On a Google Home app, where there is no display, it is a very common occurrence to want to send a user further materials in the form of a document or a link to a web page, etc. It would be very helpful to send them such an item to their linked Google E-mail account.

from actions-on-google-nodejs.

mInzamamMalik avatar mInzamamMalik commented on May 30, 2024

finally they took my question seriously :-)

---------- Forwarded message ----------
From: Actions on Google Support [email protected]
Date: Wed, Nov 15, 2017 at 7:50 PM
Subject: Re: how to send followup event from webhook using action-on-google lib
To: "[email protected]" [email protected]
Cc: "[email protected]" [email protected]

Hi,

Thank you for your patience in this case. I just got an answer from our engineers confirming that it was not possible to fire a followup event with the actions on google nodejs library.
We have taken your request into account and will update you if the feature is pushed live.

Kind Regards,

Jean-Charles,
Actions on Google Support Team.

--------------- Original Message ---------------
From: inzamam malik [[email protected]]
Sent: 10/7/2017 5:42 AM
To: [email protected]
Subject: Re: how to send followup event from webhook using action-on-google lib

why you are not replying me so far

On Sep 29, 2017 6:00 PM, "inzamam malik" [email protected] wrote:
I have read rest of the api.ai document more then twice and I know well how to send followup events with simple webhook (webhook without action-on-google),
here is my repo with the sample of it (see commented code from line 35 to 54)https://github.com/malikasinger1/quizbot-reactjs-api.ai-firebase-function/blob/master/functions/src/lib/apiai-functions.ts

but my question is how to send it with action-on-google nodejs library (https://www.npmjs.com/package/actions-on-google) since we handover the request object to action-on-google and it gives us an object "app", we have methods in the object like app.ask() app.tell(), app.setContext() so i was expecting for some method like:
app.followupEvent("<event_name>",{
"<parameter_name>":"<parameter_value>>"
})

app.ask();
OR

app.askWithFollowupEvent({...
})
so what you say about this? if you dont have these method you should add one,
and please let me know some place where you guise discuss future plannings
On Fri, Sep 29, 2017 at 2:44 PM, Actions on Google Support [email protected] wrote:
Hi,

Thank you for your interest in Actions on Google.
I encourage you to read the api.ai documentation on follow-up events as it contains more details and examples than the page you linked to us.

Kind Regards,

Jean-Charles,
Actions on Google Support Team.

--------------- Original Message ---------------
From: [[email protected]]
Sent: 9/28/2017 4:34 PM
To: [email protected]
Subject: how to send followup event from webhook using action-on-google lib

The following message was sent to Google
by [email protected]
at 16:34 PDT on 2017-09-28.

Support request

SupportPath: /actions/support/

Sender Email: [email protected]
First Name: inzamam
Last Name: malik

requesttype: support
framework: apiai
prio: medium

Subject: how to send followup event from webhook using action-on-google lib

how to send followup event from webhook using action-on-google lib

followup event doc for reference: https://api.ai/docs/fulfillment#response

from actions-on-google-nodejs.

mymro avatar mymro commented on May 30, 2024

I really hope this will be added soo.

from actions-on-google-nodejs.

mInzamamMalik avatar mInzamamMalik commented on May 30, 2024

hey collaborators, any update regarding this?

from actions-on-google-nodejs.

roschler avatar roschler commented on May 30, 2024

Is this feature in the main branch yet, or is the CLA still pending?

from actions-on-google-nodejs.

eriklindebratt avatar eriklindebratt commented on May 30, 2024

+1!

from actions-on-google-nodejs.

davidverweij avatar davidverweij commented on May 30, 2024

@Iridio this worked perfectly! Good temporary approach.

from actions-on-google-nodejs.

Canain avatar Canain commented on May 30, 2024

Closing this as it's merged in v1 and available in v2.

from actions-on-google-nodejs.

mInzamamMalik avatar mInzamamMalik commented on May 30, 2024

is it possible in v2?

from actions-on-google-nodejs.

xinunix avatar xinunix commented on May 30, 2024

Wow thank you I have asked this question in the DialogFlow Help Forum and to my local Google rep and have yet to get an answer from either. It would be really nice to see this brought into some of the other documentation that talks about events but never makes mention of this method.

from actions-on-google-nodejs.

grctest avatar grctest commented on May 30, 2024

Has anyone had success passing parameter data through conv.followup() with the latest library version?

I can successfully trigger the target intent via the event name configured within dialogflow, however the parameters don't seem to survive the trip other than as the original input parameter data stored in the _actions_on_google context stored prior to the followup triggering.

Do I need to be retrieving the passed parameter data from the event's contents explicitly, or should I be able to followup with parameters defined in the dialogflow intent?

Cheers 👍

from actions-on-google-nodejs.

Iridio avatar Iridio commented on May 30, 2024

from actions-on-google-nodejs.

kencanak avatar kencanak commented on May 30, 2024

Has anyone had success passing parameter data through conv.followup() with the latest library version?

I can successfully trigger the target intent via the event name configured within dialogflow, however the parameters don't seem to survive the trip other than as the original input parameter data stored in the _actions_on_google context stored prior to the followup triggering.

Do I need to be retrieving the passed parameter data from the event's contents explicitly, or should I be able to followup with parameters defined in the dialogflow intent?

Cheers 👍

did you manage to get it work @grctest ? cause i am facing the same issue. can't seems to use the parameters value in my response

from actions-on-google-nodejs.

grctest avatar grctest commented on May 30, 2024

@kencanak I did not, however given that v2.4.0 changed followup to not purge 'conv.data', I've chosen to pass data to the followup intent via 'conv.data.variable' fields.

from actions-on-google-nodejs.

sureshapn avatar sureshapn commented on May 30, 2024

The only thing I can think of, is that you did not create an intnet with the event you want to be activated by the followupEvent command.

Thankyou man

from actions-on-google-nodejs.

eriklindebratt avatar eriklindebratt commented on May 30, 2024

@grctest @kencanak Seeing the exact same thing, reported it in a separate issue.

from actions-on-google-nodejs.

valgaze avatar valgaze commented on May 30, 2024

For anyone doing archaeology on this issue in the future, here is the tl;dr:

  • 2 Intents: Parent Intent & Child Intent

  • In the Dialogflow web console, add an event called "my_event" to Child Intent & no training input phrases

  • In the fulfillment code for Parent Intent, you can trigger the Child Intent (which is bound to event my_event) with the following:

app.intent('parent intent', (conv, parameters) => {
   conv.followup('my_event');
});
  • If you wanted to pass parameters with the event you can do this (but it probably won't work the way you're expecting):
app.intent('parent intent', (conv, parameters) => {
    const myData = { a:1, b:2, c:3, d: 'efgh' };
    conv.followup('my_event', myData); // pass in object
});

Then in DialogFlow web console, inside Child Intent you would select parameters & explicitly map each property as a parameter.

Important trick: under the value column, you need to following the format of #event.property, ex

|| Value ||
#my_event.name.a
#my_event.name.b
#my_event.name.c
#my_event.name.d

Then in your Child Intent handler code you can access them as parameters:

app.intent('child intent', (conv, parameters) => {
    const { a, b, c, d} = parameters;
    conv.ask(`Got the data! ${a}, ${b}, ${c}, {d}`)
});

If you can't be bothered with all that to pass around data & trigger an intent, you can use conv.data as an escape hatch of sorts. Note we still use an event to trigger/invoke the Child Intent, we just don't pass the event data.

From Parent Intent fulfillment handler:

app.intent('parent intent', (conv, parameters) => {
    const myData = { a:1, b:2, c:3, d: 'efgh' };
    conv.data = myData; // attach whatever data to conv.data
    conv.followup('my_event_name'); // No data on event
});

And in Child Intent handler:

app.intent('child intent', (conv, parameters) => {
    const { a, b, c, d } = conv.data;
    conv.ask(`Got the data! ${a}, ${b}, ${c}, {d}`)
});

from actions-on-google-nodejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.