Fulfillment Hosting

You can use any web hosting platform that supports HTTPS to host your fulfillment. For your convenience, we provide a Node.js client library that parses requests and generates the necessary JSON payloads for responses.

If you don't already have a preferred hosting platform, we'll show you how to deploy to a production environment with Cloud Functions for Firebase with one of our samples. We also show you how to deploy a generic project with Google App Engine and Heroku.

Deploying to Cloud Functions for Firebase

When you create an Actions on Google project, a corresponding Firebase project is also created. This makes it easy to use Firebase products, such as Cloud Functions for Firebase, and many of our samples are built to support Cloud Functions for Firebase. We'll show you how to deploy fulfillment with one of our samples in the following sections.

Get the Facts About Google sample

We'll use our Facts About Google sample for this example. To get the sample, download and unzip the Facts about Google sample from GitHub or clone the repository.

We'll refer to the sample directory as <sample_dir>. The sample directory contains a Dialogflow agent (<sample_dir>/FactsAboutGoogle.zip) and the corresponding fulfillment (sample_dir/functions/index.js), which you'll deploy to Cloud Functions for Firebase.

Deploy the fulfillment

  1. Download and install Node.js.
  2. Set up and initialize the Firebase CLI. If the following command fails with an EACCES error, you may need to change npm permissions.

    npm install -g firebase-tools
  3. Authenticate the firebase tool with your Google account:

    firebase login
  4. Navigate to your Action project directory and initialize Firebase. You'll be asked to select which Firebase CLI features you want to setup for your Actions project. Choose Functions and other features you might want to use, like Firestore, then press Enter to confirm and continue:

    cd <sample_dir>
    firebase init
  5. Associate the firebase tool with your Actions project by selecting it using the arrow keys to navigate the projects list:

  6. After choosing the project, the firebase tool will start the Functions setup asking you what language you want to use. Select using the arrow keys and press Enter to continue.

    === Functions Setup
    A functions directory will be created in your project with a Node.js package pre-configured. Functions can be deployed with firebase deploy. ? What language would you like to use to write Cloud Functions? (Use arrow keys) > JavaScript TypeScript
  7. Choose if you want to use ESLint to catch probable bugs and enforce style typing Y or N:

    ? Do you want to use ESLint to catch probable bugs and enforce style? (Y/n)
  8. Get the project dependencies by typing Y to the prompt:

    ? Do you want to install dependencies with npm now? (Y/n)

    Once the setup is completed, you'll see an output similar to the following:

    ✔  Firebase initialization complete!
  9. Install the actions-on-google dependency

    cd <sample_dir>/functions
    npm install actions-on-google
  10. Get the fulfillment dependencies and deploy the fulfillment function:

    npm install
    firebase deploy --only functions

    The deployment takes a few minutes. Once completed, you'll see output similar to the following. You'll need the Function URL to enter in Dialogflow.

    ✔  Deploy complete!
    Project Console: https://console.firebase.google.com/project/myprojectname-ab123/overview Function URL (factsAboutGoogle): https://us-central1-myprojectname-ab123.cloudfunctions.net/factsAboutGoogle

  11. If you're using Dialogflow: In the Dialogflow console's navigation menu, click Fulfillment, toggle the Webhook button to ENABLED , and replace the url in the URL field with your Function URL.

  12. If you're using Actions SDK: Create an object inside the conversations object to declare your fulfillment in your action package:

  "actions": [
      "description": "Default Welcome Intent",
      "name": "MAIN",
      "fulfillment": {
        "conversationName": "myFulfillmentFunction"
      "intent": {
        "name": "actions.intent.MAIN",
        "trigger": {
          "queryPatterns": [
            "talk to myFulfillmentFunction"
  "conversations": {
    "myFulfillmentFunction": {
      "name": "myFulfillmentFunction",
      "url": "https://us-central1-myprojectname-ab123.cloudfunctions.net/cloudFunctionName"
  "locale": "en"

Other hosting options

Deploying to Google App Engine

  1. Download Google Cloud SDK.
  2. Download and install Node.js.
  3. In the Cloud Platform Console, go to the Projects page and select or create a new project. This should be the project you are using for your actions.
  4. Enable billing for your project. See the console help center for more information. Note: Note the Project ID, since it is used for configuration and deployment.

  5. Initialize the Cloud SDK with the following command:

    gcloud init
  6. Run the following commands to configure your Google cloud project:

    gcloud config set project <project-id>
  7. Deploy fulfillment:

    cd <fulfillment-app-dir>
    gcloud app deploy

    You should see a long response from the gCloud CLI (it may take a few minutes) with the final portion looking similar to:

    Updating service [default]...done.
    Deployed service [default] to your-appengine-url.appspot.com
    You can read logs from the command line by running:
      $ gcloud app logs read
    To view your application in the web browser run:
      $ gcloud app browse

Deploying to Heroku

See the Heroku documentation for full instructions on setting up a project and deploying it.

  1. Sign up for a Heroku account if you don’t already have one.
  2. In your Heroku Apps list, click New > Create New App in the top right and specify an app name.
  3. Download the Heroku CLI. To ensure it works, run heroku --version.
  4. If your project is not already in a Git repo, initialize your project directory:

    cd git init

  5. Type heroku login and enter your credentials to log in to the Heroku CLI.

  6. Run heroku git:remote -a <HEROKU_APP_NAME> to register your remote Heroku project repository with your local Git project. If you already have a Git repo in your Heroku project, then clone the repo with heroku git:clone -a <HEROKU_APP_NAME>.

  7. Add and commit your files if you haven’t already, using git add . and git commit -am "Initial commit"

  8. Use git push heroku master to push your local project files to Heroku

  9. Make sure you set your Heroku app’s URL as the fulfillment Webhook URL in the Fulfillment page of the Dialogflow console.

  10. You can view your projects logs using with heroku logs