Enabling the Google Cloud Natural Language API
The setup steps for the Google Cloud Natural Language API, from creating the project through to calling it from a FlutterFlow app.
This is the part that is fiddly the first time and trivial afterwards, which is exactly the kind of thing worth writing down.
1. Create a Google Cloud project
- Go to the Google Cloud Console — console.cloud.google.com
- Click the project dropdown and choose New Project.
- Name it and click Create.
2. Enable the API
- Go to APIs & Services > Library.
- Search for Natural Language API.
- Click Enable.
An API that exists in the catalogue is not an API your project can call. Enabling it per-project is a separate step, and forgetting it produces a permission error that reads like a credentials problem.
3. Create a service account
- Go to IAM & Admin > Service Accounts.
- Click Create Service Account.
- Give it a name and an ID.
- Assign the role Natural Language API Admin.
- Click Done.
4. Generate the service account key
- Open the service account you just created.
- Go to the Keys tab.
- Click Add Key > Create New Key.
- Choose JSON and download the file.
Store this file securely. It is a credential, not a config file — anyone holding it can call the API and bill it to your project. Keep it out of version control.
5. Upload the key to FlutterFlow
- In FlutterFlow, go to Settings and Integrations > Integrations.
- Turn on Enable Google Cloud Natural Language API.
- Upload the JSON key file.
6. Define the API calls
- Go to the API Calls section.
- Define the endpoints you need — sentiment analysis, entity recognition, and so on.
- Create REST API calls matching the functions the app will perform.
7. Wire the calls to the interface
- Select the widget that should trigger the call, such as a button.
- Open Actions in the Properties Panel on the right.
- Click + Add Action.
- Search for and select the Google Cloud Natural Language API action.
- Set the action type and supply the parameters — for example, the text to be analysed.
Testing and optimisation
- Test with real users. The responses that look fine in a preview are not always the ones people actually generate.
- Optimise for accuracy and experience, in that order. A fast wrong answer is worse than a slow right one.
Keeping it working
- Build in a feedback loop so you can see how the model performs against real input over time.
- Revisit it. Hosted models change underneath you, and the behaviour you tested against is not permanent.