Dialogflow CX integrates with GitHub. This integration makes it easy to export your agent to JSON for a push to GitHub, and to pull from GitHub for an agent restore. The JSON exported format pushed to GitHub is the expanded zip file contents of the exported agent.
Using this feature allows you to take advantage of GitHub source control features like:
- Agent change reviews using code review tools
- Examine agent diffs using diff tools
- Merges
- And so on
Limitations
The following limitations apply:
- GitHub has a rate limit for the number of requests per hour (5000 for non-enterprise accounts, 15,000 for enterprise accounts). If your agent push exceeds this limit, the Dialogflow console will report the rate limit error. You can retry the push after an hour. This limitation will be addressed in a later Dialogflow release.
- Private access self-hosted repos are not supported, because Dialogflow cannot access these repos.
Configuration
To configure this integration:
- Open the Dialogflow CX Console.
- Choose your Google Cloud project.
- Select your agent.
- Click the Manage tab.
- Click Git in the Testing & Deployment section.
- Click Add Git integration, and a configuration dialog opens.
- Enter the following:
- Display name for the GitHub connection.
- GitHub repository URL (for example:
https://api.github.com/repos/<repository_owner>/<repository_name>
). - GitHub branch name.
- GitHub personal token.
If you use a fine-grained personal access token,
you need the following
permissions
access:
- Repository Permissions > Contents: Read and write
- Repository Permissions > Metadata: Read-only (should be auto-selected after selecting Contents permission)
- Click Connect.
This configuration can be changed at any time by clicking on the edit icon.
Push and restore
Once configured, you can push/pull your agent to/from GitHub.
The Push button is used to export your agent and make a commit to the GitHub branch. This commit will consist of the entire agent and not specific changes, and will delete any existing files in the repository.
For new repositories, make sure that there is at least one commit from GitHub before using the push option in the Dialogflow console.
The Restore button is used to pull your agent data from the GitHub branch and restore your Dialogflow agent from this data. This will overwrite your agent in the same way that any agent restore behaves.
Example use case
The following example illustrates how this feature can be used by multiple people to propose different agent changes to a production agent.
Consider that your agent uses the following GitHub branches:
- Prod: branch for your production agent
- Dev1: branch for agent development
- Dev2: another branch for agent development
User 1 wants to propose agent changes and takes the following steps:
- Export the production agent to a new agent.
- Make the desired changes to this agent copy.
- Test the changes.
- Push the altered agent to the Dev1 branch.
- Create a merge request to the Prod branch.
User 2 wants to propose agent changes and takes the following steps:
- Export the production agent to a new agent.
- Make the desired changes to this agent copy.
- Test the changes.
- Push the altered agent to the Dev2 branch.
- Create a merge request to the Prod branch.
User 3 reviews merge requests from both users and takes the following steps:
- Resolve conflicts.
- Commits approved changes.
- Restores the production GitHub branch to the production Dialogflow agent.