Skip to content

3. (write code) Create & connect webhook, create cloud functions #20

@JessePeplinski

Description

@JessePeplinski

Resources

Code Examples

Firebase Documentation

Webbook @JessePeplinski

  • Create Webbook - - This is where we have all the business logic for responding to requests. This is also where the API integrations will go. We currently have boilerplate code.
  • Connect Webhook - We'll connect this to Dialogflow once we have an endpoint. It is connected, and Dialogflow is now using our endpoint. Now when we talk in DialogFlow, it doesn't do anything interesting (yet) because we need to write code.

Project Design / Architecture

organizing-your-firebase-cloud-functions - this is how we should eventually structure our project

│
└───functions
    │   index.js - Contains all cloud functions
    └─── exports.dialogflowFirebaseFulfillment - contains all google action logic
    └─── exports.createUserAccount - add user to db when they authenticate
    └─── exports.cleanUpUserData - When a user is deleted, set flag in the db

Write Code

Google Actions & Dialogflow

Responses to our intents and add all relevant contexts and context parameters. Will be able to test this in Dialogflow by checking "use webhook".

  • Locations
    • List all locations
    • Add
    • Update
    • Delete
  • Items
    • List all items
    • Add
    • Update
    • Delete
  • Expiration Dates
    • List all expiration dates
    • Add
    • Update
    • Delete
  • Grocery List / Cart
    • List all items in cart
    • Add
    • Update
    • Delete
    • Purchase

Routines and Reminders

  • Reminder of the items that are expiring soon or that have expired

Database

@JessePeplinski and @ZacharyPeck to work together to integrate.

GREAT RESOURCE HERE

  • Connect to DB
  • Add users to DB with a cloud function (named exports.addUsertoDatabaseWithAuth
  • Read something from DB (GET)
  • Add something to DB (POST)
  • Listen for changes onWrite see handle event data here. Not sure if we even have to do this with realtime database, but good for testing to make sure that we are actually manipulating db.

Dynamic Population

Update status of items based on intents. We will need to create separate intents for add / remove / delete. This can be tested from the Firebase Console --> Database.

  • Locations
    • List all locations
    • Add
    • Update
    • Delete
  • Items
    • List all items
    • Add
    • Update
    • Delete
  • Expiration Dates
    • List all expiration dates
    • Add
    • Update
    • Delete
  • Grocery List / Cart
    • List all items in cart
    • Add
    • Update
    • Delete
    • Purchase

Resources

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions