Import Scripts
Create and customize scripts in the Genesys Cloud UI. Then you can use the upload endpoint to move your masterpieces to another org.
File Import
To import a script, make a POST request to url https://apps.mypurecloud.com/uploads/v2/scripter. The domain name of the url should be the same as the one you use when using the Genesys Cloud app (e.g., apps.mypurecloud.com.au, if you're based in Australia).
The request headers should include the Authorization header with the same bearer token that you would use to make other API requests. The body of the POST should be a form encoded value with the following details:
Form Field | Value |
file | File containing the script to upload |
scriptName | The script name you want to use |
scriptIdToReplace | The script id you want to replace with the new imported content |
Post Example
Here is an example that uses file data from an <input type='file'>
$('document').ready(function () {
$('#file-input').change(function (event) {
uploadScripts(event.target.files[0]);
});
});
function uploadScripts(file) {
var data = new FormData();
data.append('file', file);
data.append('scriptName', 'Script Name');
$.ajax({
url: 'https://apps.mypurecloud.com/uploads/v2/scripter',
type: 'POST',
headers: {
Authorization: 'bearer ' + authToken
},
data: data,
processData: false,
contentType: false
});
}
Check import status
To check the status of the script you can look at /api/v2/scripts/uploads/{uploadId}/status.