Web Inbox - Local Dev
This page describes how to get web inbox working on a local dev machine from first principles.
Create a test page
Create a new html page
<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>
Install python and run the following in the folder holding the page:
python3 -m http.server 8092
Open your web browser at http://localhost:8092/
You should see the following

Add the Optimove SDK
Add the script tag using your tenant id and token (see https://developer.optimove.com/docs/web-sdk-integration-guide-v3#basic-setup-a-idbasic-setupa for more info).
For example (add your own tenant id and token)
<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
<script src="https://sdk.optimove.net/v2/websdk/?tenant_id=123&tenant_token=abcd1234"></script>
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>
Add 'localhost' to the list of domains that resolve to the brand you want to use with Web Inbox

Setting localhost to map to your brand
Due to caching it can take up to 10 minutes for the new domain mapping to take effect. You can see if domain mapping is resolving correctly by looking for the config
url call e.g.

Example in which domain mapping has failed
When the changes have taken effect you should see the config coming back

Successful config call returning info about inbox
If you do not see the config call then it may be because it has already been made successfully and cached in the browser. You can see this in the dev tools under Application
:

Cached config data
Testing the inbox
You should be able to open the web inbox by calling show inbox from the JavaScript console. To begin with there will not be any messages.
optimoveSDK.API.Inbox.showInbox();

Test page with inbox opened via JavaScript call
Close the inbox by clicking the X in the top right hand corner and call setUserId. Make sure to provide the id of a customer for whom you have targeted in an Optimove campaign.
optimoveSDK.API.setUserId('<Your user name here>');
Open the inbox again by calling showInbox as above. You should see the user messages.

Updated 3 days ago