Git Product home page Git Product logo

isabella232 / assistant-conversation-nodejs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from actions-on-google/assistant-conversation-nodejs

0.0 0.0 0.0 2.15 MB

A developer friendly way to fulfill Actions SDK handlers for the Google Assistant

Home Page: https://actions-on-google.github.io/assistant-conversation-nodejs

License: Apache License 2.0

Shell 2.04% JavaScript 0.42% TypeScript 97.54%

assistant-conversation-nodejs's Introduction

Actions SDK Node.js Fulfillment Library

This fulfillment library exposes a developer friendly way to fulfill Actions SDK handlers for the Google Assistant.

NPM Version Build Status

Setup Instructions

Make sure Node.js >=10.18.0 is installed.

Install the library with either npm install @assistant/conversation or yarn add @assistant/conversation if you use yarn.

Example Usage

// Import the appropriate service and chosen wrappers
const {
  conversation,
  Image,
} = require('@assistant/conversation')

// Create an app instance
const app = conversation()

// Register handlers for Actions SDK

app.handle('<YOUR HANDLER NAME>', conv => {
  conv.add('Hi, how is it going?')
  conv.add(new Image({
    url: 'https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/imgs/160204193356-01-cat-500.jpg',
    alt: 'A cat',
  }))
})

Frameworks

Export or run for your appropriate framework:

Firebase Functions

const functions = require('firebase-functions')

// ... app code here

exports.fulfillment = functions.https.onRequest(app)

Actions Console Inline Editor

const functions = require('firebase-functions')

// ... app code here

// name has to be `ActionsOnGoogleFulfillment`
exports.ActionsOnGoogleFulfillment = functions.https.onRequest(app)

Self Hosted Express Server

const express = require('express')
const bodyParser = require('body-parser')

// ... app code here

const expressApp = express().use(bodyParser.json())

expressApp.post('/fulfillment', app)

expressApp.listen(3000)

AWS Lambda API Gateway HTTP proxy integration

// ... app code here

exports.fulfillment = app

Next Steps

Take a look at the docs and samples linked at the top to get to know the platform and supported functionalities.

Library Development Instructions

This library uses yarn to run commands. Install yarn using instructions from https://yarnpkg.com/en/docs/install or with npm: npm i -g yarn.

Install the library dependencies with yarn. If you want to run any of the sample apps, follow the instructions in the sample README.

Functionality

Public interfaces, classes, functions, objects, and properties are labeled with the JSDoc @public tag and exported at the top level. Everything that is not labeled @public and exported at the top level is considered internal and may be changed.

References & Issues

Make Contributions

Please read and follow the steps in the CONTRIBUTING.md.

License

See LICENSE.

assistant-conversation-nodejs's People

Contributors

canain avatar fleker avatar kkocel avatar taycaldwell avatar

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.