Google assistant webhook

Google assistant webhook DEFAULT

Build a Webhook for Google Assistant Action

This post is all about how to build your webhook for your Google Assistant action and host it temporarily on Gitpod and test your code.


  • Node JS
  • Express JS
  • Basics on how to use Github

If you have these in place, Let’s get started.

What is Gitpod?

First of all I would like to start this section by saying, I ❤ Gitpod. Gitpod is an online IDE for Github. Gitpod provides you with a fully working developer environment, including a VS Code-powered IDE and a cloud-based Linux container configured specifically for the project at hand. Just prefix your Github repo URL with ””, So that the final link looks something like this ”

Let’s start building

I have created a Github repo which will help you get started without any hassle. The repo is basically a boilerplate to get started with building your webhook. The code is written in Node JS, So it would be easier for you to build on top of it if you are already familiar with Node JS. We will be using the action-on-google Node JS library (This client library makes it easy to create Actions for the Google Assistant and supports Dialogflow, Actions SDK, and Smart Home fulfillment.).

Create your Action

Google Actions Console

  • Enter your project name and click on create project.

Google Actions Create New Project Prompt

  • Now select a category for your Action.
  • Now under the Develop menu, give your action a name.
  • Now head over to actions menu in Develop tab and click on Add your first action.

'Add your first action' button

  • In the next section choose custom intent and click on build. Doing this will redirect you to the Dialogflow console and it should look something like this.

Dialogflow console

  • Click on create to create your agent on Dialogflow.
  • Once your agent is ready, you will already have two default Intents (Default Fallback Intent and Default Welcome Intent) in place and these two do pretty good at their job.
  • Now it’s time to create a new intent and enable fulfillments for that intent so that we can serve responses from the webhook that we will be building in the next section.
  • Click on create a new intent, give it a name and training phrase (training phrase will be used to invoke the intent). Now that your intent is almost ready scroll down and under fulfillments enable webhook call for the new Default welcome intent and the new intent you just created.

Understanding .gitpod.yml

The .gitpod.yml file is used to automate setting up the environment required to run your app.

.gitpod.yml environment setup for running your app

If you want to access services running in your workspace, e.g. a development HTTP server on port 8080, you need to expose that port first. Gitpod has two means of doing that:

  1. On-the-fly: when you start a process which listens on a port in your workspace, Gitpod will ask you if you want to expose that port to the internet.
  2. In your configuration: if you already know that you want a particular port exposed, you can configure it in the .gitpod.yml file and skip the extra click later on. For example:

When starting or restarting a workspace you typically want to run certain tasks. Most probably that includes the build and maybe also running tests and automatically start the application in e.g. a dev server.

Gitpod allows you to configure start tasks in the .gitpod.yml file.

For instance, the start script for this repository is defined as:

You can have multiple tasks, which are opened on separated terminals.


The init property can be used to specify shell commands that should only be executed after a workspace was freshly cloned and needs to be initialized somehow. Such tasks are usually builds or downloading dependencies. Anything you only want to do once but not when you restart a workspace or start a snapshot.

In our case the command is

Get the Gitpod setup running

  • Fork my repo (dialogflow-webhook-boilerplate-nodejs)or just click on the run in gitpod button in my repo. (If you do this you have to fork it from the workspace so that you can commit your own changes to your repo).
  • Now you can just prefix your repo url with ””. This should take you to Gitpod and start your workspace. The workspace take a little while to start.
  • Once the workspace is running you should see something like this.

Gitpod Workspace

  • If you notice the Node app is already running in the first terminal. This is automated by a Gitpod configuration file. And the webhook URL is printed on to the second terminal. All the dependencies that are required are also installed while creating the workspace.

Gitpod integrated Linux Terminals

  • Now that the webhook is running and i presume that you already have your agent on Dialogflow (If not create an agent), Next thing you need to do is to copy the webhook URL from the terminal and paste it in the Fulfillments section in the Dialogflow Console.

Dialogflow console Fullfillments section

  • Open the index.js file which contains the code for the webhook.

File index.js which contains the source code for the webhook

The file initially contains this code. Now lets add some more code to it to display a card when we invoke the new intent we created in the previous section. actions-on-google library provides many functionalities to can simplify your task to render rich responses in your action.

We will be adding the following code to display a card when the new intent is invoked.

Code to display a card when the new intent is invoked

Replace the URL’s and other contents in the code and stop the previous instance of the app from running and start it again after you have made changes to the code by running in the terminal.

  • To test your action you can click on See how it works in Google Assistant in the Dialogflow console.

See how it works in Google Assistant

  • Invoking the intent would give you response similar to this.

Response on invoking the intent

Refer to the links below to add your own functionalities.

Links to Refer


Gitpod can make your life much simpler by automating your development setup just by adding a simple configuration file to your repo. You can refer to the Gitpod Docs to learn more about the platform. Gitpod lets you work with unlimited workspace but with 100hrs/month runtime. It also provides Personal and unlimited plans as well. If you are a student then you can claim Gitpod Unlimited plan for just $9.

Animated character waving hand with a smile

Share this post:

  • Twitter
  • Reddit

In this post I’ll be integrating Google Home and IFTTT Webhooks. Before we begin it is important to understand you are not specifically targeting Google Home devices but rather Google Assistant. Google Assistant can be running on a multitude of different devices like phones or tablets that are not necessarily on the same local network as your Google Home device. With that in mind it makes sense that any HTTP connections made from Google Assistant and IFTTT will be executing in the cloud not the device your are using. To reach local endpoints from Google Assistant you need a publicly accessible endpoint which means you have to open ports on your firewall, have a static IP or DNS name and a web server running to respond to the HTTP calls. Alternatively you can use a relay service like Azure Relay Hybrid Connections or one of the self hosted open source options like Thinktecture RelayServer to enable public connections without opening firewall ports. Both solutions bring up a host of security considerations which I decided to bypass for now by using Azure Functions as the target for the HTTP calls for testing.

The Solution

Connect Your Google Account And IFTTT
This is pretty straight forward so I won’t be explaining the process, just follow this example it.

Create The Azure Function
You can start with a basic HTTP triggered function using this example. For added security I’ll be making a few changes to the function.

  • Under Function App settings -> Networking -> SSL, switch on HTTPS only.
  • Under Integrate  -> Selected HTTP Methods uncheck everything except POST.
  • Under Integrate -> Authorization level select anonymous.

At the time of writing IFTTT didn’t support custom headers in their WebHooks but I needed a way to send an auth key to the Azure Function. I decided to add the auth key to the body of the request and confirm the key myself. Usually you rely on the Azure Functions builtin authentication functionality that requires an “x-functions-key” header.

To test the WebHook call I wanted to extract information like the auth key, ingredient and calling IP address to display it in the log file. You can find the C# code I used in my function here.

Create The IFTTT Applet
In IFTTT create a new applet and choose Google Assistant as the service and “Say a phrase with a text ingredient” as the trigger. Select Webhooks as the action. For this fictional scenario I wanted to shut down devices remotely so I configured my trigger and action like this.

Integrating Google Home And IFTTT Webhooks

Take note of the request JSON body, it contains the auth key and the text ingredient you specified in the trigger using the $ sign. You also have the option to use a number ingredient in which case you use a # sign to represent the number. Use the Add Ingredient button to add your ingredient to the request body or URL, don’t type $ or #.

And here is the result.

Integrating Google Home And IFTTT Webhooks

I tested from my phone but it worked the same from Google Home, just no screenshots 🙂

Francois Delport

I am a cloud and devops consultant, technology fan and previously a professional C# developer with a keen interest in system design and architecture. Currently I am involved in projects using Azure, the Microsoft stack and DevOps. I am based in Melbourne, Australia. Email: [email protected]

Latest posts by Francois Delport (see all)

Published by

Francois Delport

I am a cloud and devops consultant, technology fan and previously a professional C# developer with a keen interest in system design and architecture. Currently I am involved in projects using Azure, the Microsoft stack and DevOps. I am based in Melbourne, Australia. Email: [email protected] View all posts by Francois Delport

  1. Pinterest masculine cards
  2. Printable o antiphons
  3. Lilly singh book amazon
  4. Xolos 2017 schedule

Actions on Google: Webhook Boilerplate

This sample demonstrates the base webhook required for building Actions on Google for use on Google Assistant -- using the Node.js client library and deployed on Cloud Functions for Firebase.

This code sample was built using Dialogflow. We now recommend using Actions Builder or the Actions SDK to develop, test, and deploy Conversational Actions.

Setup Instructions

Select only one of the options below.

Option 1: Add to Dialogflow

Select the button below and follow prompts to create a new agent:

Webhook Boilerplate

Option 2: Dialogflow Console and Firebase CLI


  1. Node.js and NPM
    • We recommend installing using NVM
  2. Install the Firebase CLI
    • We recommend using version 6.5.0,
    • Run with your Google account


Actions Console

  1. From the Actions on Google Console, New project (this will become your Project ID) > Create project > under More options > Conversational
  2. From the top navigation menu under Develop > Actions (left nav) > Add your first action > BUILD (this will bring you to the Dialogflow console) > Select language and time zone > CREATE.
  3. From the left menu > select Intents > Default Welcome Intent, scroll down to the end of the page and under Fulfillment > Enable Webhook > Save.
    • This will allow you to have the welcome intent be a basic webhook intent to test.

Firebase Deployment

  1. On your local machine, in the directory, run
  2. Run to deploy the function
    • To find your Project ID: In Dialogflow console under Settings > General tab > Project ID.

Dialogflow Console

  1. Return to the Dialogflow Console > select Fulfillment > Enable Webhook > Set URL to the Function URL that was returned after the deploy command > SAVE.
  2. From the left navigation menu, click Integrations > Integration Settings under Google Assistant > Enable Auto-preview changes > Test to open the Actions on Google simulator then say or type .

Running this Sample

  • You can test your Action on any Google Assistant-enabled device on which the Assistant is signed into the same account used to create this project. Just say or type, “OK Google, talk to my test app”.
  • You can also use the Actions on Google Console simulator to test most features and preview on-device behavior.

References & Issues

Make Contributions

Please read and follow the steps in the




Your use of this sample is subject to, and by using or downloading the sample files you agree to comply with, the Google APIs Terms of Service.

Google Assistant Action Builder Webhook Handlers

Webhooks triggered by Google Assistant

I noticed that is using a Google Assistant integration that allows them, basically, to set up for each of their users some kind of "trigger words" that trigger a call to a webhook. I searched a lot in the API docs and found no proper way to do the same, only ways to set up conversations or IoT interactions.

I kind of want to build something similar to the IFTTT integration with a way to programmatically set up actions via an API (not via the dashboard).

Is it possible to do or is this just a custom development Google made for IFTTT?

In my researches I found out about something called "Direct actions" but it does not seem to exist anymore in the Google Assistant Doc. Can you help me with that?

I don't know if my questions are very clear, please tell me if they are not

Thanks in advance for your help

Have a good day

asked Mar 13 '19 at 7:30


1111 silver badge33 bronze badges


Assistant webhook google


Build Actions for Google Assistant using Actions Builder (Codelab 1)


Similar news:


1917 1918 1919 1920 1921