Importing intents

note

This section is about programmatically importing intent data from custom applications. If you are looking to automate your workflows, our command line tool allow importing and exporting intents in various formats and can be easily added to custom scripts and continuous integration pipelines.

Request#

Endpoint#

PartValue
URLhttps://api.humanfirst.ai/v1alpha1/workspaces/<NAMESPACE>/<WORKSPACE_ID>/intents/import_http
MethodPOST
BodyMulti-part form data

Note: To find your namespace and the workspace id, see this.

Request body#

The body is in multi-part form data with the following fields:

FieldTypeDescription
formatstringThe format of the exported data. See Data format
filebytesThe data to import.
requestImportIntentsRequestOptional request object to define more options. See the API Reference.
Data format#

Specifies the format in which the intent data is going to be converted before exporting.

Numeric formatString formatDescription
1INTENTS_FORMAT_CSV_SIMPLE_INTENTSTwo-column csv formatted as text,intent_name - fields delimited by ""
2INTENTS_FORMAT_RASA_MARKDOWNRasa 1.0 NLU format
3INTENTS_FORMAT_RASA_YAMLRasa 2.0 NLU format
5INTENTS_FORMAT_DIALOGFLOW_ES_AGENTDialogflow agent export format
7INTENTS_FORMAT_HF_JSONHumanFirst JSON format
8INTENTS_FORMAT_COGNIGY_JSONCognigy intents JSON format

Curl example#

note

In the following example, the hf command line tool is used to fetch a valid access token. See how to install and configure it here.

To import intents into a workspace using our JSON format, use the following curl command:

curl -s -X POST \
-H 'Authorization: Bearer '(zia auth print-access-token) \
-F 'data=@/path/to/workspace.json' \
-F 'format=INTENTS_FORMAT_HF_JSON' \
-F 'request={"import_options": {"merge_intents": true}}' \
'https://api.humanfirst.ai/v1alpha1/workspaces/humanfirst/playbooks-GTK76SAJL5B3XFLRMIA33I2E/intents/import_http'