Here are the implementation steps to ML-Utterances export using the API.
PART 1:
-
We suggest you to always use postman for testing purpose with the following sample request format. Open postman > import > Paste raw text
curl -X POST \ ‘https://{{host}}/api/public/bot/{{bot_id}}/mlexport?state=configured&=&type=csv’
-H ‘auth: {{YOUR_JWT_ACCESS_TOKEN}}’
-H ‘content-type: application/json’ -
Go to bot builder > create a new api scopes (from bot builder)> update all the required scopes (from the documentation) > Publish the bot.
-
Using https://jwt.io/ please generate a JWT token. Make sure the payload looks the same as the screenshot. Paste your app id (client id) and client secret.
-
Paste all the collected details in the sample request (url, bot id, JWT token)
Shared the screenshot of the request created by us for testing purpose.
PART 2:
After using the ML Utterances Export API, to generate the download link, please use the ML Utterance Export Status API .
Sharing the documentation link for ML Utterance Export Status API.
Steps:
-
Please create the request same as the ML Utterances Export API, but with minute changes.
curl -X GET
https://{{host}}/api/public/bot/{{bot ID}}/mlexport/status
-H ‘auth: {{YOUR_JWT_ACCESS_TOKEN}}’
-H ‘content-type: application/json’ \ -
Replace the host url, bot ID and JWT token in the above sample request.
-
Test the request in postman, in response body it will give you a download link url.
4. Copy and paste the link in any browser and it will generate the csv exported file.