Migrating Contacts Integration from Email Classic to Staffbase Email

Learn how to migrate your integration from the Contact API used in Employee Email (Classic) to the User API or CSV Import API in Staffbase Email.

Staffbase Email
Employee Email (Classic)

The Employee Email (Classic) Contact API is being deprecated together with the Employee Email (Classic) platform. To continue managing contacts effectively in Staffbase Email, Staffbase recommends migrating any existing Contact API integrations to one of the following APIs:

This guide walks you through both migration paths in detail.

Moving away from the Employee Email (Classic) and Contact API enables you to take advantage of a more robust and feature-rich platform with improved performance, modern authentication for enhanced security, and expanded contact management capabilities.

The first step in migrating from the Contact API is selecting the right replacement API. Your choice depends on your technical requirements and business needs, and it will define the architecture of your new integration. You can choose between a real-time or bulk-processing approach:

  • User API: This API is the ideal choice for event-driven systems that require immediate data consistency. Use it if your integration needs to respond instantly to changes. For example, a Staffbase account needs to be created as soon as a new employee is added to your Human Resources Information System (HRIS). The User API provides the necessary endpoints for direct, real-time control. It’s built for low-latency, transactional operations on individual contact records.
  • CSV Import API: This API is best suited for scenarios involving large datasets and scheduled updates. Use it if you’re migrating a significant volume of contacts from a legacy system or working with batch exports. The CSV Import API provides the necessary endpoints for efficient and reliable bulk data processing. It is designed to handle thousands of records at once and includes a stateful import process that you can monitor.
FeatureUser APICSV Import API
Primary Use CaseReal-time, individual contact management and event-driven synchronization.Bulk import, large-scale initial migration, and scheduled batch updates.
Process TypeSynchronous. Each call returns an immediate success or failure response for each call.Asynchronous and stateful. You trigger an import that runs in the background.
Data FormatJSON objects sent in the request body.Comma-Separated Values (CSV) files.
Best ForInstant contact creation and updates.
HRIS integration for live changes.
High-frequency updates triggered by user actions.
Large-scale initial migration.
Daily or weekly contact data syncs.
Systems that can only export data in file format.
Error HandlingImmediate per-request error responses. For example, HTTP 400 or 500 codes.Detailed error reports are generated after the import process, with row-by-row issue details.
DependenciesRequires a client application that can make direct, authenticated API calls.Requires the ability to generate and temporarily host or upload CSV files.
Typical LatencyVery low (milliseconds to seconds).Higher (minutes to hours, depending on file size), as it runs as a background process.
  • Create an API token with administrative access via the Staffbase Studio.

The Staffbase platform API authentication method is different from the API key authentication used in the Employee Email (Classic) platform. Therefore, any existing Employee Email (Classic) API keys are not compatible with Staffbase Email.

  • Before importing contacts, ensure all custom fields in your JSON payload or CSV file are set up in Staffbase Studio.
    To identify the required fields, check the customFields object (reference) nested in the contacts object in your current Employee Email (Classic) JSON data and add any missing fields in the Studio before proceeding. Learn more.

For the migration example, we need to add the following custom fields:

  • team
  • costcenter

Employee Email (Classic) JSON example

{
"contacts": [
{
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@email.com",
"location": "Vancouver",
"department": "Sales",
"jobTitle": "SDR",
"customFields": {
"team": "Team A",
"costcenter": "12345"
}
},
{
"firstName": "Jane",
"lastName": "Doe",
"email": "jane.doe@email.com",
"location": "Vancouver",
"department": "Sales",
"jobTitle": "VP",
"customFields": {
"team": "Team B",
"costcenter": "12345"
}
},
{
"firstName": "Jim",
"lastName": "Doe",
"email": "jim.doe@email.com",
"location": "Vancouver",
"department": "Product",
"jobTitle": "Engineer",
"customFields": {
"team": "Team B",
"costcenter": "12345"
}
}
]
}

The User API accepts data in JSON format. If you choose to migrate using the User API, you can continue using your existing JSON contact data with minimal adjustments. Ensure that your JSON structure aligns with the User API’s requirements, particularly regarding field names and data types.

For more information on JSON examples, refer Create Contact.

For this example, the individual contact objects need to be adjusted as follows:

  • Move the fields firstName, lastName, email, location, department, and jobTitle into a nested profile object.
  • Add the mandatory field externalId mapped to the email address.
  • Rename jobTitle to position.
  • Move custom fields from the customFields object to the profile object.
  • Add a status field with the value "contact" to indicate that the user is a contact.

Converted JSON example (1st contact)

{
"externalId": "john.doe@email.com",
"email": "john.doe@email.com",
"profile": {
"firstName": "John",
"lastName": "Doe",
"location": "Vancouver",
"department": "Sales",
"position": "SDR",
"team": "Team A",
"costcenter": "12345"
},
"status": "contact"
}

To create a new contact, make a POST request to the /api/users endpoint with the new contact’s data in the request body. You need to make individual requests for each contact.

Once your data is prepared and your custom fields are configured, you can start to set up the integration. When creating contacts via the User API, set "status": "contact" for contacts.

The CSV Import API requires data in CSV format. Convert your existing JSON contact data into a CSV file that meets the following requirements:

  • Each system and custom field must be represented as a column header.
  • Each row must contain contact data in the same order as the headers.

For CSV examples, refer CSV File Examples.

For this example, the individual contact objects need to be adjusted as follows:

  • Flatten the structure by removing nested objects.
  • Add a column for the mandatory field externalId mapped to the email address.
  • Rename jobTitle to position.
  • Move custom fields from the customFields object to the top level.
  • Ensure all fields are represented as columns in the CSV file.

Converted CSV example

externalId,firstName,lastName,email,location,department,position,team,costcenter
john.doe@email.com,John,Doe,john.doe@email.com,Vancouver,Sales,SDR,Team A,12345
jane.doe@email.com,Jane,Doe,jane.doe@email.com,Vancouver,Sales,VP,Team B,12345
jim.doe@email.com,Jim,Doe,jim.doe@email.com,Vancouver,Product,Engineer,Team B,12345

To learn how the CSV file should be formatted and encoded, refer Setting up the CSV File.

Once your data is prepared and your custom fields are configured, follow the Get Started With CSV Import to start the import. When importing via CSV, set "type": "CONTACT" for contacts and "type": "USER" for users.