Speebly uses Google Dialogflow (Natural Language Processor) to power its voice agents. This tutorial is for when you have created an agent in Dialogflow and you want to have it work with the Speebly SDK on your phone. And so, the pre-requisite for this tutorial is that you have have the SDK running in Xcode (see Get Started for iOS tutorial).
Note: If you already have your agent set-up, skip to the last step...
Step 1: Open Dialogflow and navigate to your Google Cloud Project service account page
Sign in to Dialogflow
Select the agent that you would like to use In Speebly
Click on the gear icon, to the right of the agent name.
Under the GOOGLE PROJECT section, click on the name of the Service Account.
The name of my service account is email@example.com
When you click on this link it will take you to your Google Cloud Projects Service Accounts page
Your browser should look like this:
Step 2: Create a new service account
Click on the Create Service Account button at the top of the page.
On the create service account page , enter a name for the service account.
Now we need Grant this service account access to the project and add the Dialogflow Client API role. Click on Select a role.
Under the Dialogflow category, select the Dialofflow Client AOI role
Step 3: Create service account key and save to your computer
Click on the CREATE KEY button
A popup will appear on the screen. Click on JSON
Click CREATE. A message will appear
Make a note of the name of the file
Click close. This will save the file to your downloads folder on your computer.
Step 4: Using the service account key
Click on downloads
Select the service account file we downloaded from the Google Cloud
Copy the file and past it the root of the iOS project you added speebly client sdk
Rename the service account name to Speebly_Service_Info.json. This file name is case sensitive (this file will replace the one that came with the sample project)
In Xcode, add the file to the project (see below) then re-start the simulator. It should now be connected to your own Dialogflow agent.