There are two ways to delete an intent in python using the DialogFlow Python Client. You can delete them singularly, or you can batch delete them.
In either case, you first grab the dialogflow.IntentsClients and the project_agent_path.
intents_client = dialogflow.IntentsClient()
parent = intents_client.project_agent_path(manage_dialogflow_project_id())
To delete an intent, you just need to know the full name of the intent. Notice, that is NOT the display name. There are multiple ways to get the intent name using the python client.
At that point, intents are simply deleted with the "delete_intent" call.
intents_client.delete_intent(intent_name)
To delete all the intents, you just need a list of the intents, which you can get with:
intents = intents_client.list_intents(parent)
Then you can batch delete them:
if intents:
intents_client.batch_delete_intents(parent, intents)
You could also filter the above list before deleting it, such as.
intents_client = dialogflow.IntentsClient()
parent = intents_client.project_agent_path(manage_dialogflow_project_id())
intents_to_delete = []
intents = intents_client.list_intents(parent)
for intent in intents:
log(intent.name)
log(intent.display_name)
if ## Condition met for deletion, such as '"search_string" in intent.display_name:'
intents_to_delete.append(intent)
if intents_to_delete:
intents_client.batch_delete_intents(parent, intents_to_delete)