Skip to content

Instantly share code, notes, and snippets.

@spasiu
Created January 18, 2017 00:06
Show Gist options
  • Select an option

  • Save spasiu/7cf5e078151b83b6a6c6edef9dbab284 to your computer and use it in GitHub Desktop.

Select an option

Save spasiu/7cf5e078151b83b6a6c6edef9dbab284 to your computer and use it in GitHub Desktop.
Example of an embedded Smooch Web Messenger instance that opens in full width, and sends an initial message
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.sk-msg, .sk-msg-image {
font-size: 18px !important;
max-width: 350px !important;
}
.sk-from {
font-size: 18px !important;
}
.sk-msg-avatar {
width: 50px !important;
}
</style>
</head>
<body>
<div id="conversation"></div>
<script src="https://cdn.smooch.io/smooch.min.js"></script>
<script>
Smooch.init({
appToken: 'YOUR_APP_TOKEN',
userId: 'YOUR_USER_ID',
embedded: true
}).then(() => {
Smooch.sendMessage('HI!')
Smooch.render(document.getElementById('conversation'));
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment