Installation
Before you start implementing the parleychat into your website, make sure you have the latest version.
You can download the files from our Parley CDN .
Just click on the buttons to get the latest version of the files.
We do not recommend you to directly load the files in through these urls. Please download the files and host them on your own webserver.
For customized files, you can request the creation of these files by contacting support
- https://www.parleycdn.com/latest/{YOUR_ACCOUNT_IDENTIFIER}/app.js
- https://www.parleycdn.com/latest/{YOUR_ACCOUNT_IDENTIFIER}/messenger.css
- https://www.parleycdn.com/latest/{YOUR_ACCOUNT_IDENTIFIER}/firebase-messaging-sw.js ( optional)
1. Include style
Include the style document (css) in your <head> tags
<head>
<link rel="stylesheet" href="./dist/messenger.css">
</head>
2. Import javascript
Import the app.js into the page just before you close your body tag
<body>
<script src="dist/app.js"></script>
</body>
3. Include Parley settings
Setup the basic parleychat settings by creating an inline <script> tag after your <body> like so:
<body>
<script>
window.parleySettings = {
roomNumber: '{YOUR_ACCOUNT_IDENTIFIER}',
runOptions: {
country: "en",
},
weekdays: [
["Sunday"],
["Monday", 8.00, 22.00],
["Tuesday", 8.00, 22.00],
["Wednesday", 8.00, 22.00],
["Thursday", 8.00, 22.00],
["Friday", 8.00, 22.00],
["Saturday"] // we are closed, sorry!
],
fcmConfig: {
serviceWorkerLocation: '/firebase-messaging-sw.js'
}
}
</script>
</body>
Make sure that the location of the firebase-messaging-sw.js is the same as defined in the serviceWorkerLocation setting. You do not have to include that script seperately like with app.js in step 2.
If you do not want to use FCM, you can use the following setting: enabled, to disable the FCM setup. When you use this setting and set it to “false”, you then don’t need the serviceWorkerLocation setting and the “firebase-messaging-sw.js” file.
Load settings dynamically
If you load the configuration before loading the app.js, the library will use that configuration. If you want to load the configuration after the library is loaded, you can use the parleyConstructor function
var config = {
roomNumber: '{YOUR_ACCOUNT_IDENTIFIER}',
runOptions: {
country: "en",
},
weekdays: [
["Sunday"],
["Monday", 8.00, 22.00],
["Tuesday", 8.00, 22.00],
["Wednesday", 8.00, 22.00],
["Thursday", 8.00, 22.00],
["Friday", 8.00, 22.00],
["Saturday"] // we are closed, sorry!
],
fcmConfig: {
serviceWorkerLocation: '/firebase-messaging-sw.js'
}
};
window.parleyConstructor(config);