Comment on page
Synchronize users data with Subiz API
API (application programming interface) is a set of clearly defined methods of communication between various software components. Subiz provides a Javascript API that synchronizes users data between the Subiz app and the website. You can update users information, retrieve users and clear users.
Important notes:
- API snippets should be placed after the Subiz embed code in the website code page. No need to follow closely, just make sure the Subiz embed code is placed over the API snippets.
- To use Javascript API, only programmers can install according to instructions. If your business does not have its own programmer, hire a frelance programmer to help them.
The four default user attributes set up on Subiz are about basic user information, such as: Full name, Email address, Phone number, Address.
Subiz lets you create and generate new attributes about your users, based on criteria that is specific to your business. You can user this data as qualification data to qualify leads and boost sales. You can also use this data to filter and send targeted Automation messages.
To add a new attribute, you log in App.subiz.com > SETTING > ACCOUNT > User Attributes > Select New Attribute

Create new attribute on Subiz
You can use the Javascript Subiz API to update automatically your default user attributes on Subiz or update your own custom user attributes.
Here is an example of Javascript API to update full-name attribute:
<script>
subiz('updateUserAttributes', [{ key: 'fullname', text : 'David’ }]);
</script>
Things must remember:
- Key is attribute key
Here are just some examples of what our JavaScript API lets you do:
Full name attribute
Phone number attribute
Email address attribute
<script>
subiz('updateUserAttributes', [{ key: 'fullname', text : 'David’ }]);
</script>
<script>
subiz('updateUserAttributes', [{ key: ’phones’, text : '09123456789', '0987654321' }]);
</script>
<script>
subiz('updateUserAttributes', [{ key: 'emails’, text :'exa[email protected], [email protected]' }]);
</script>
Update simultaneously multiple default attributes
<script>
subiz('updateUserAttributes', [{ key:'fullname', text : 'David' },{ key:'phones', text : '09123456789' } ]);
</script>
Below are two examples of such custom attributes as Language and Customer:
Language attribue
Customer attribute
<script>
subiz('updateUserAttributes', [{ key:'ngon_ngu', list : [‘Vietnamese’, ‘English’] } ]);
</script>
<script>
subiz('updateUserAttributes', [{ key:'khach_hang', boolean : true }]);
</script>
API allows you to delete user data on Subiz. The deleted data includes all information on the visitor's browser in Subiz. Therefore, when you deleted, you can't see this user anymore.
<script>
subiz('forgetMe');
</script>
API allows you to synchronizes user data from Subiz to website.
API synchronizes user data from Subiz to website
<script>
subiz('getUserAttributes', (attributes) => {console.log('user attributes', attributes)});
</script>
The API allows the website to assign the display language of Subiz Widget. After that, you can decide which page displays Vietnamese or English.
This is an example of Javascript API to assign English for Subiz widget, inside "en" is the language code:
<script>
subiz('setLanguage', 'en');
</script>
Language code is the representation of names of languages according to ISO 639-1 standard (two characters) and the language that Subiz currently support. You could refer the list of languages that Subiz supported.
The API allows you to expand Subiz Widget. For example, you can create a button on the website so that when visitors click on that button, the Subiz widget will expand.
- The example bellow will show you API expand Subiz widget via Javascript function.
<script type="text/javascript">
window.subiz('expandWidget')
</script>
- API attach a link to order to Expand Subiz widget.
<a href="#nogo" onclick="subiz('expandWidget')">Text of </a>
- API Shrink Subiz widget.
<script type="text/javascript">
window.subiz('shrinkWidget')
</script>
- API attach the link to shrink Subiz widget.
<a href="#nogo" onclick="subiz('shrinkWidget')">text của </a>
The API allows you use a CSS code to Customize the Subiz widget base on your idea. The function helps you to customize Subiz widget for each website with its own style.
<script type="text/javascript">
window.subiz('changeCss', '.widget_mini .widget_body {height: 750px !important; max-height: 800px !important;}')
</script>
You can customize widget position by utilizing API code as follow:
subiz('setPosition', 'left') . value left or right
Customizing widget type: standard or full height by using this API code:
subiz('setWindowMode', 'full') . value full or mini
You can change the instruction on header by using by this API code:
subiz('setLanguageData', {}) . VD subiz('setLanguageData', {message_input_help: "Type", joined_the_conversation: "joined"})
The API allows you to actively ask the user if they were agree to receive a notification when their Subiz widget has a new message. You can Link chat widget to a text or an image on website or link to increase the number of people who agree to receive notifications.
- API subscribe to receive notifications.
<script type="text/javascript">
subiz('subscribePushNotification')
</script>
- API to unsubscribe to receive notifications.
<script type="text/javascript">
subiz('unsubscribePushNotification')
</script>
- API to check if the user has agreed to receive notifications?
<script type="text/javascript">
subiz('checkPushNotification', function(status) {
console.log(status)
})
</script>