Import Export Bot

1. Objective

It is possible to export then import - i.e. duplicate or clone - a bot with the BMS API. Usually, this operation is done in order to duplicate a production instance to a stagging instance or in order to switch from a SaaS server to an OnPremise server.

2. Operating mode

The procedure takes place in 4 steps (excluding optional stage):

  • Launch an export of the bot

  • Wait for the end of the bot export / Check the status of the operation

  • [Optional] Download the bot export

  • Launch the import of the bot

  • Wait for the end of the bot import / Check the status of the import

2.1 Prerequisites

In order to carry out all the steps, it will be necessary to have:

  • The UUID of the bot to export - source bot

  • The UUID of the target bot

  • The token on the server of the bot to be exported (see "Basic HTTP" authentication)

  • The token on the server of the target bot (cf. "Basic HTTP" authentication) and to know the pages of call to the API of dydu.

These pages are accessible via the following address: https://[server]/servlet/api/doc3/index.html

For example, for the SaaS earth server, it is: https://app1.earth.doyoudreamup.com/servlet/api/doc3/index.html Each API is then accessible in its category.

2.2 Bot export

The bot is exported using the Export bot data API, available in the Transfer Bot data category.

Fill in the necessary fields then launch the export:

  • botUUID : UUID of the bot to export (ex: "52345ac9-1804-4898-96df-5ce03d800e50")

  • includeGalery: true (except if you don't want to export the gallery)

  • Authorization: authorization token (ex: "Basic bG9naW46bW90ZGVwYXNzZQ==")

  • DialogsPassword: password to decode the dialogs (only fill in if you have enabled the "Encrypt dialogs" option in the BMS, otherwise leave empty). Then click on Execute

2.2.1 Success

If all goes well, you should have a 202 return code and no return message.

2.2.2 Errors

If you get a 403 error, with a message like:

"error": "Missing or invalid parameters [authentication]"

Remember to check if your login / password pair is correct and if you did not forget the "Basic" before your encoded token.

2.3 Wait for the end of the export / Check the status of the operation

The export of the bot is carried out thanks to the API Get export bot data status, available in the category Transfer Bot data.

Fill in the necessary fields then launch the operation:

  • botUUID: UUID of the bot to export (ex: "52345ac9-1804-4898-96df-5ce03d800e50")

  • Authorization: authorization token (ex : "Basic bG9naW46bW90ZGVwYXNzZQ==")

2.3.1 Success

If all goes well, you should have a return code 200 and a return message confirming the successful operation. In the return message it will say "exportStatus": "DONE".

If the export takes a long time - in the case of large knowledge bases or numerous dialogues - the return message will contain "exportStatus": "PROCESSING". In this case, the status should be checked later (after 5-10 minutes) to see if the export is complete.

2.3.2 Errors

In case of an error, you will still get a return code 200. In the return message it will say "exportStatus": "ERROR".

The reason(s) for these errors are detailed in the message. One of the reasons is a problem with the synchronisation of the chatbox configurations. You will then see a message of type "configurationsStatuses":{"5588419e-2fc7-4266-97aa-bd0982d2593c": "TO_FIX". This explains that the chatbox with the ID 5588419e-2fc7-4266-97aa-bd0982d2593c has to be fixed before exporting.

2.4 Download the bot export

This step is optional and not recommended as it adds complexity to the process.

If you wish to download your bot's data, you must use the API Get exported bot data, available in the Transfer Bot data category.

Fill in the necessary fields and launch the operation:

  • botUUID: UUID of the bot to export (ex: "52345ac9-1804-4898-96df-5ce03d800e50")

  • Authorization: authorization token (ex : "Basic bG9naW46bW90ZGVwYXNzZQ==")

Success If everything goes well, you should have a return code 200 and a link that appears allowing you to download the file.

2.5 Bot import

The import of the bot is done thanks to the API import bot data from url, available in the category Transfer Bot data.

This API allows you to import a zip from a URL, whether it is the bot export URL or a classic URL such as https://www.monsite.com/exports/monbot.zip.

Fill in the necessary fields then launch the export:

  • botUUID: UUID of the target bot (ex : "c3e2fc66-6139-11eb-ae93-0242ac130002")

  • Authorization: authorization token of the target bot (ex: "Basic bm91dmVhdWxvZ2luOm5vdXZlYXVtbW90ZGVwYXNzZQ==")

  • Url-Authorization: authorization token of the source bot (ex: "Basic bG9naW46bW90ZGVwYXNzZQ==")

  • body: Url of the zip (ex: "https://www.monsite.com/exports/monbot.zip") or of the export API (ex: "https://app1.earth.doyoudreamup.com/servlet/api/bot/exported/c3e2fc66-6139-11eb-ae93-0242ac130002")

Two notables here:

It is only possible to import a configuration on an existing bot. If you don't have a bot, it is necessary to create one before. If you import on an existing bot, the existing data will not be deleted. The Url-Authorization field is only useful if you retrieve the export from the BMS export API.

Success If all goes well, you should have a return code 202 and no return message.

2.6 Wait for the end of the import / Check the status of the operation

The import of the bot is carried out thanks to the API Get import bot data status, available in the category Transfer Bot data.

Fill in the necessary fields then launch the operation:

  • botUUID: UUID of the target bot (ex : "c3e2fc66-6139-11eb-ae93-0242ac130002")

  • Authorization: authorization token of the target bot (ex: "Basic bm91dmVhdWxvZ2luOm5vdXZlYXVtbW90ZGVwYXNzZQ==")

2.6.1 Success

If all goes well, you should have a return code 200 and a return message confirming the successful operation. The return message will say "importStatus": "DONE".

This return message - in JSON format - will also contain the details of the import:

  • startDate and endDate: respectively the start date of the import and the end date of the import

  • importedKnowledges : Return on the knowledge import

  • importedDialogs : Return on the dialogs import

  • importedUsers : Return on the import of users

If the export is long - in the case of a large knowledge base or many dialogues - the return message will contain "importStatus": "PROCESSING". In this case, the status should be checked later (after 5-10 minutes) to see if the export is complete.

2.6.2 Errors

In case of an error, you will still get a return code 200. In the return message it will say "importStatus": "ERROR".

The reason(s) for these errors are detailed in the message.

3. Export / import limits

This bot export / import operation works well for the following elements:

  • Knowledge base

  • Chatbox v4 configuration

  • The users

  • Languages and consultation spaces

but two points need special attention.

The first concerns the dialogues which are not exported in their entirety but only in part. In concrete terms, the export operation only exports the dialogues of the last 30 days and it is not possible to go beyond that.

The second point concerns formulation groups from the social database or from external databases - such as the meta assistant. The link with groups of formulations from external bots is not always maintained. In concrete terms, the use of groups of formulations from the social database or external databases refers to IDs. These IDs are not necessarily the same from one server to another and therefore require manual modification. The groups of formulations defined within the bot will be well preserved and correctly imported.

4. Logs

The import logs are available once the action is completed. To do this, you can go to the "Console" section and display the messages in Info. Example:

Last updated

Tous droits réservés @ 2023 dydu.