Uploading Contacts to a Contact List
Introduction
Once you've created a contact list, you'll want to upload contacts to it from a CSV file (an example CSV file of contacts is included in the source code for this tutorial).
Session Initialization
First, authorize with Genesys Cloud and get the list of contact lists. This example adds each list to a dropdown in the UI to allow the user to choose the list without knowing the ID.
File Selection UI
Next, create a way to select the file you want to upload. This example uses jQuery's changed handler to initiate the upload when a user selects a file.
The Upload Request
To upload contacts to Genesys Cloud, the POST request is constructed by building the form data body and configuring the request. This primarially consists of the form data body and the auth token in the header. For full documentation on the upload request, see the Dev Center article Upload Contact Lists.
After constructing the request, the user-selected file is posted to the Genesys Cloud upload service. This request may take some time to complete when uploading large contact lists.