Normally, you create and delete intents using the console. However, in certain advanced scenarios, you may find it easier to use the API.
Create an intent
The following examples show how to call the Create
method for the Intent
type.
Select a protocol and version for the Intent reference:
Protocol | V3 | V3beta1 |
---|---|---|
REST | Intent resource | Intent resource |
RPC | Intent interface | Intent interface |
C++ | IntentsClient | Not available |
C# | IntentsClient | Not available |
Go | IntentsClient | Not available |
Java | IntentsClient | IntentsClient |
Node.js | IntentsClient | IntentsClient |
PHP | Not available | Not available |
Python | IntentsClient | IntentsClient |
Ruby | Not available | Not available |
REST
Before using any of the request data, make the following replacements:
- PROJECT_ID: your Google Cloud project ID
- REGION_ID: your region ID
- AGENT_ID: your agent ID
HTTP method and URL:
POST https://REGION_ID-dialogflow.googleapis.com/v3/projects/PROJECT_ID/locations/REGION_ID/agents/AGENT_ID/intents
Request JSON body:
{ "displayName": "My intent display name" }
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_ID/locations/REGION_ID/agents/AGENT_ID/intents/INTENT_ID", "displayName": "My intent display name", "priority": 500000 }
Update an intent
The field mask guide shows how to update individual fields of an intent.
Delete an intent
The following examples show how to call the Delete
method for the Intent
type.
Select a protocol and version for the Intent reference:
Protocol | V3 | V3beta1 |
---|---|---|
REST | Intent resource | Intent resource |
RPC | Intent interface | Intent interface |
C++ | IntentsClient | Not available |
C# | IntentsClient | Not available |
Go | IntentsClient | Not available |
Java | IntentsClient | IntentsClient |
Node.js | IntentsClient | IntentsClient |
PHP | Not available | Not available |
Python | IntentsClient | IntentsClient |
Ruby | Not available | Not available |
REST
Before using any of the request data, make the following replacements:
- PROJECT_ID: your Google Cloud project ID
- REGION_ID: your region ID
- AGENT_ID: your agent ID
- INTENT_ID: your intent ID, found in the create response
HTTP method and URL:
DELETE https://REGION_ID-dialogflow.googleapis.com/v3/projects/PROJECT_ID/locations/REGION_ID/agents/AGENT_ID/intents/INTENT_ID
To send your request, expand one of these options:
You should receive a successful status code (2xx) and an empty response.