Git Product home page Git Product logo

bm-nodejs-appointment-bot's Introduction

BUSINESS MESSAGES: Appointment Bot

This sample demonstrates how to create an appointment setting agent for the Business Messages platform using Dialogflow and the Business Messages Node.js client library.

This sample runs on the Google App Engine.

See the Google App Engine (https://cloud.google.com/appengine/docs/nodejs/) standard environment documentation for more detailed instructions.

Documentation

The documentation for the Business Messages API can be found here.

Prerequisite

You must have the following software installed on your machine:

Before you begin

  1. Register with Business Messages.
  2. Once registered, follow the instructions to enable the APIs for your project.

Setup your API authentication credentials

This sample application uses a service account key file to authenticate the Business Messages API calls for your registered Google Cloud project. You must download a service account key and configure it for the sample.

To download a service account key and configure it for the sample, follow the instructions below.

  1. Open Google Cloud Console with your Business Messages Google account and make sure you select the project that you registered for Business Messages with.

  2. Create a service account.

    1. Navigate to Credentials.

    2. Click Create service account.

    3. For Service account name, enter your agent's name, then click Create.

    4. For Select a role, choose Project > Editor, then click Continue.

    5. Under Create key, choose JSON, then click Create.

      Your browser downloads the service account key. Store it in a secure location.

    6. Click Done.

    7. Copy the JSON credentials file into this sample's /resources folder and rename it to "bm-agent-service-account-credentials.json".

Create a Business Messages agent

  • Open the Create an agent guide and follow the instructions to create a Business Messages agent.

Create a Dialogflow agent:

  1. Open Dialogflow Console with your Google account and create a new Dialogflow agent.

  2. After the agent is created, click the great icon next to the name of your agent in the left navigation.

  3. Click the Service Account email field. This will open the Service accounts page within the Google Cloud Console.

  4. Download a service account key.

    1. Click the three dots for see the overflow menu for the existing service account in the table.

    2. Click Create key.

    3. One the dialog that opens, click Create to download the service account key.

    4. Copy the JSON credentials file into this sample's /resources folder and rename it to "df-agent-service-account-credentials.json".

  5. Go back to the Dialogflow Console and from the agent configuration page, click Export and Import.

  6. Click the RESTORE FROM ZIP button and select the zip file within this samples root directory called dialogflow-appointmentbot.zip.

  7. Once the Dialogflow agent is imported, click Fulfillment from the left navigation.

  8. Under Webhook, click the Disabled toggle onto Enabled and enter https://PROJECT_ID.appspot.com/fulfillment/dfCallback in the URL field. Replace PROJECT_ID with the Google Cloud project you created and registered with Business Messages.

  9. Click SAVE at the bottom of this page.

Update the sample launch page Business Messages agent test URL

  1. Open the views/index.ejs file from the samples route directory.

  2. Locate the Chat now anchor link and update the href value to your agent's test URL. You can retrieve your agent's test URL by issuing a GET request via Business Communications API for your agent.

Deploy the sample

  1. In a terminal, navigate to this sample's root directory.

  2. Run the following commands:

    gcloud config set project PROJECT_ID

    Where PROJECT_ID is the project ID for the project you created when you registered for Business Messages.

    gcloud app deploy
  3. On your mobile device, use the test business URL associated with the Business Messages agent you created. Open a conversation with your agent and follow the prompts to book an appointment.

    See the Test an agent guide if you need help retrieving your test business URL.

bm-nodejs-appointment-bot's People

Contributors

thefalc 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.