Environments

TalkJS has two environments, test mode and live mode. Test mode is intended for developing and testing your application, whereas live mode is for use in production.

When you sign up for TalkJS, you get access to test mode, which is free to use. Your chat UI will have a banner saying "You're in TalkJS Test Mode", and your data will not be backed up as frequently as in live mode.

To use TalkJS in your production environment, you need to subscribe to one of our plans and switch to live mode.

Switch your application to live mode

To switch to live mode, follow these steps.

Access live mode settings

First, access the settings for live mode in your dashboard. To do this, go to the Settings page in your TalkJS dashboard, and toggle the switch in the top bar of the dashboard to Viewing live mode:

A toggle switch with the label 'Viewing live mode'

Replace your app ID and secret key

Your test mode and live mode each come with a different app ID and secret key. Once you’ve switched to live mode settings in the dashboard, you can find the app ID and secret key for your live environment on the Settings page, in the General section.

In the code where you add TalkJS to your application, make sure that all instances of appID match the app ID for your live mode. If you already had the app ID for your test mode in your code, that means you have to replace all instances of the test mode app ID with your live mode app ID.

For example, in the following code snippet, replace <APP_ID> with your live mode app ID:

1const session = new Talk.Session({
2 appId: '<APP_ID>', // replace with your own live mode app ID
3 me: me,
4});

If you use the REST API, you will also need to update your secret key in your requests.

Note: If your application or website has multiple environments — for instance, a test environment and a production environment — that use different TalkJS environments, it might be a good idea to store your live mode and test mode TalkJS credentials as environment variables in your code. This allows you to try out new themes, roles, or any other customization on your test environment before going live to production with any changes.

Publish your theme changes to live mode

If you have created or edited any themes in the Theme Editor, you will need to publish them to live mode. To publish your themes, go to the Themes page of the dashboard.

From the overview of themes in the UI themes section, select the theme that you’d like to use in your live app, and select the Publish to live button:

Overview of a row in the list of UI themes on the 'Themes' page of the dashboard, with the text ‘example_theme’, with the label 'Modified' next to it. Below that is the text 'This theme does not yet exist in your live environment. Click “Publish to live” to copy it there.'

If you’re using multiple themes, repeat the process of publishing to live for each theme.

Publish your Chat UI settings changes to live mode

If you have made any changes to the settings in the Chat UI section of the dashboard (either by editing the default role or by creating new roles), you will need to publish them to live mode. To publish the chat UI settings for a role, go to the Chat UI page of your dashboard, and select the Publish to live button:

Section on the Chat UI page of the dashboard which states 'Editing settings for role default in your test environment', where 'default' is selected from a dropdown menu. Below that are links for 'View live version' and 'Edit roles', as well as a button 'Publish to live'.

For example, to publish the chat UI settings for the default role, make sure that "default" is selected in the section "Editing settings for role <ROLE> in your test environment.", and then select Publish to live.

Note: Chat UI settings always apply to a specific user role. If you don’t specify anything else, your users get the default role. You can leave the role at default and never think about it again. However, if you want different chat UI settings to apply to different user types – for example buyer and seller, or student and teacher – then you could create different roles, and assign different UI settings to each role.

If you are using multiple roles, make sure to publish the chat UI settings for each of those roles to live.

Data in live and test environments

Your test mode and live mode environments do not share conversations, users or other data. This allows you to have separate test data in your test environment that you can modify and repopulate as you need.

If you do want data from your test mode in live mode (for example, if you have migrated from another chat provider and have first tested your data import in test mode), you will need to use the REST API to export your test mode data and import it into live mode. For guidance on this, see our Import messages page.