Inline editor to connect firebase

917 views
Skip to first unread message

Julian Uribe

unread,
May 17, 2021, 4:58:07 AM5/17/21
to Dialogflow CX Edition users
hi, noted DF CX doesn't have inline editor to connect to firebase as was done at DF ES, any solution?

David Macias

unread,
May 18, 2021, 6:36:57 AM5/18/21
to Dialogflow CX Edition users
Julian,

If you create a cloud function to handle your fulfillment via webhook you'll get almost the same IDE experience, it's just not built in to DF.

On Monday, May 17, 2021 at 4:58:07 AM UTC-4 Julian Uribe wrote:
hi, noted DF CX doesn't have inline editor to connect to firebase as was done at DF ES, any solution?

Yasar Ramjan Makandar

unread,
May 20, 2021, 8:14:43 PM5/20/21
to Dialogflow CX Edition users
Note that Dialogflow ES now uses Google Cloud Functions in the inline editor.

You would need to use a webhook to connect Dialogflow CX to Cloud Functions for Firebase or Google Cloud Functions.

You can then deploy and run functions by utilizing Cloud Functions for Firebase or Google Cloud Functions and use the functions URL as the webhook url for your agent. For the Google Cloud functions, you can find here a tutorial. Also, you can go through a tutorial for Cloud Functions for Firebase.

Once a function has been created, you may now create a webhook in the Dialogflow CX Console and use the deployed function URL as the webhook URL of your agent.

Julian Uribe

unread,
May 23, 2021, 5:49:03 PM5/23/21
to Dialogflow CX Edition users
well, i am a noob, but deal with it and have running project in firebase and is linked to cloud console also, even tho got the realtime database created:

realtimedatabase1.png

the specific question is how to get data from page (state), idk if my goal is to get the parameters responses is ok to enable the webhook in fulfillment landing page or in each parameter:

fullfillmentwebhookentrevista.png


here is the webhook i´ve created and also the most important question, where i mustpreguntascredencialeswebhook.png take the auth credentials asked?:

Marianne Lerin

unread,
Jun 1, 2021, 6:39:59 PM6/1/21
to Dialogflow CX Edition users

Based on your followup question, it seems that the difficulty you’re facing is the connectivity of the Firebase database with the webhook.

Upon checking the webhook configuration screenshot in your CX agent, it looks like the webhook URL used is the URL for the database and not from a deployed function.

With that, you would need to deploy a function either in Google Cloud Functions or Cloud Functions for Firebase as mentioned in previous response and update your webhook code to connect your firebase database by initializing it.

To connect to your database, you need to first initialize your firebase database.

To initialize, you can try to implement this code:

var config = {

    apiKey: "apiKey", // your api key

    authDomain: "projectId.firebaseapp.com", // your authDomain

    databaseURL: "https://databaseName.firebaseio.com", // your databaseURL

    storageBucket: "bucket.appspot.com

  };

  firebase.initializeApp(config);


For more information on this, please refer to this Initialize the Realtime Database JavaScript SD document.

Once you finish initializing your firebase database in your webhook code, then you may use the function URL, if the webhook is deployed using Firebase Functions or Google Cloud Functions, as the webhook URL for your agent.

Note that webhook code doesn't have to be on Google Cloud Functions or Cloud Functions for Firebase. Kindly make sure that your webhook service accepts JSON requests and returns JSON responses. 

To get information on a certain page, you may create a condition route in which you can call the webhook once the condition evaluates to true.  For example, in $page.params.status = “FINAL”, in your fulfillment, you may enable webhook and extract the value of your page parameter/s using the pageInfo.formInfo.parameterInfo or sessionInfo.parameters field in webhook request

In addition, an Authentication can be added to secure your webhook. This is to ensure that requests to your webhook are authorized. 

Reply all
Reply to author
Forward
0 new messages