Skip to content

Commit

Permalink
Updated Spark README
Browse files Browse the repository at this point in the history
  • Loading branch information
svetlanap-Google authored Jan 6, 2020
1 parent 43cdfdf commit 9814c2e
Showing 1 changed file with 38 additions and 15 deletions.
53 changes: 38 additions & 15 deletions spark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,47 @@

### Prerequisites

In order, to setup this integration, you must do the following first:
- Create a [Spark account](https://teams.webex.com/signin)
- Clone the [git repo](https://OUR_GIT_REPO)
- Follow the instructions on the [main README file](https://github.com/GoogleCloudPlatform/dialogflow-integrations#readme) in the root directory of this repository.
- Create a [Spark account](https://teams.webex.com/signin).
- Replace the value of __projectId__ in the [server.js file](https://github.com/GoogleCloudPlatform/dialogflow-integrations/blob/03676af04840c21c12e2590393d5542602591bee/spark/server.js#L36) with your Dialogflow agent’s Project ID.

### Create the Spark Bot
### Creating a Spark Bot

Login to Spark and go the
[New Bot page](https://developer.webex.com/my-apps/new/bot). Fill in the
required fields with what you want, and then click the Add Bot button. On the
next screen you should see a box with your __bot's access Token__. Set the
constant sparkAccessToken in server.js to this value.
Log in to Spark and go to the [New Bot page](https://developer.webex.com/my-apps/new/bot). Fill in the required fields and then click the "Add Bot" button.

![alt text](images/spark-create-the-spark-bot.png)

### Setting the URL
On the next screen, take the value for your bot’s __access Token__ and replace the value for __sparkAccessToken__ in the [server.js file](https://github.com/GoogleCloudPlatform/dialogflow-integrations/blob/03676af04840c21c12e2590393d5542602591bee/spark/server.js#L34).

Set the constant targetUrl in server.js to your server's URL that you will use
for your webhook. If you are using Google's Cloud Run to obtain your URL, deploy
your server according to the instructions in the main README file first. This
should give you your URL. Then, update your container and redeploy after you
have added the URL to server.js.

### Deploying the Integration Using Cloud Run

In your local terminal, change the active directory to the repository’s root directory.

Run the following command to save the state of your repository into [GCP Container Registry](https://console.cloud.google.com/gcr/). Replace PROJECT-ID with your agent’s GCP Project ID and PLATFORM with the platform subdirectory name.

```shell
gcloud builds submit --tag gcr.io/PROJECT-ID/dialogflow-PLATFORM
```

Deploy your integration to live using the following command. Replace PROJECT-ID with your agent’s GCP project Id, PLATFORM with the platform subdirectory name, and YOUR_KEY_FILE with the name (not path) of your Service Account JSON key file.

```shell
gcloud beta run deploy --image gcr.io/PROJECT-ID/dialogflow-PLATFORM --update-env-vars GOOGLE_APPLICATION_CREDENTIALS=YOUR_KEY_FILE --memory 1Gi
```

- When prompted for a target platform, select a platform by entering the corresponding number (for example, ``1`` for ``Cloud Run (fully managed)``).
- When prompted for a region, select a region (for example, ``us-central1``).
- When prompted for a service name hit enter to accept the default,
- When prompted to allow unauthenticated invocations press ``y``,
- Copy the URL given to you, and use it according to the README file in the
given integration's folder.

Take the value for the server URL printed in the console after the completion of the execution of the above command and replace the value for __targetUrl__ in the [server.js file](https://github.com/GoogleCloudPlatform/dialogflow-integrations/blob/03676af04840c21c12e2590393d5542602591bee/spark/server.js#L35).

Redeploy the integration with the updated change by rerunning the above two commands.

More information can be found in Cloud Run
[documentation](https://cloud.google.com/run/docs/deploying).

You can view a list of your active integration deployments under [Cloud Run](https://console.cloud.google.com/run) in the GCP Console.

0 comments on commit 9814c2e

Please sign in to comment.