Skip to content

Instantly share code, notes, and snippets.

@slvnperron
Created July 28, 2019 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slvnperron/db08a200ec3083262e8eef7e4f260e14 to your computer and use it in GitHub Desktop.
Save slvnperron/db08a200ec3083262e8eef7e4f260e14 to your computer and use it in GitHub Desktop.
.bpw-from-bot .bpw-chat-bubble {
background-color: #ececec;
}
.bpw-chat-bubble:last-of-type {
border-bottom-right-radius: 20px;
border-bottom-left-radius: 20px;
}
.bpw-chat-bubble:first-of-type {
border-top-left-radius: 20px;
border-top-right-radius: 20px;
}
.bpw-from-user .bpw-chat-bubble:last-of-type {
border-bottom-right-radius: 0px;
}
.bpw-from-bot .bpw-chat-bubble:last-of-type {
border-bottom-left-radius: 0px;
}
.bpw-from-user .bpw-chat-bubble {
background-color: #4278f3;
color: #ffffff;
}
.bpw-date-container .bpw-small-line {
border-bottom: none;
}
.bpw-date-container {
font-weight: 700;
font-size: 14px;
}
.bpw-header-container {
background-color: #f8f8f8;
border-bottom: none;
}
.bpw-bot-avatar img,
.bpw-bot-avatar svg {
border: none;
border-radius: 50%;
}
.bpw-composer {
padding: 10px;
background: none;
border: none;
}
.bpw-composer textarea {
background: #ececec;
border-radius: 20px;
font-size: 1.25rem;
overflow: hidden;
}
.send-btn {
position: absolute;
right: 30px;
bottom: 28px;
border: none;
border-radius: 5px;
background: #fff;
padding: 5px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
}
.send-btn:hover {
background: #d8d8d8;
}

Customizing Chat Styling

Step 1: Styling (CSS)

Please chat.css in the <bot_dir>/data/assets folder. Feel free to change the style here. Original Botpress theme can be found here.

Step 2: Loading CSS File

Now we need to instruct Botpress to use this custom CSS file for theming the webchat. For this, place 01_create_shortlink.js in the <bot_dir>/data/global/hooks/after_bot_mount folder.

Feel free to change the webchat config there, the important line to keep is the extraStylesheet property.

Result

Restart Botpress Server, and now your bot's default webchat will use your custom CSS theme!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment