From f4f56cb11ebcb05e6461642f2346bd5e54d08f3f Mon Sep 17 00:00:00 2001 From: Lukas Bachschwell Date: Tue, 10 Dec 2019 16:30:27 +0100 Subject: [PATCH] URL for chatbot server deploy --- .env.development | 2 ++ .env.production | 1 + .env.staging | 1 + README.md | 4 ++++ src/views/chatbot/index.vue | 22 +++++++++++++++++----- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/.env.development b/.env.development index 8f5856d..a162a6e 100644 --- a/.env.development +++ b/.env.development @@ -12,3 +12,5 @@ VUE_APP_BASE_API = '/dev-api' # Detail: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js VUE_CLI_BABEL_TRANSPILE_MODULES = true + +BOTPRESS_HOST = 'http://localhost:3000' diff --git a/.env.production b/.env.production index 80c8103..2e04ef6 100644 --- a/.env.production +++ b/.env.production @@ -4,3 +4,4 @@ ENV = 'production' # base api VUE_APP_BASE_API = '/prod-api' +BOTPRESS_HOST = 'https://joinbot.tk/bot' diff --git a/.env.staging b/.env.staging index a8793a0..29a83eb 100644 --- a/.env.staging +++ b/.env.staging @@ -6,3 +6,4 @@ ENV = 'staging' # base api VUE_APP_BASE_API = '/stage-api' +BOTPRESS_HOST = 'https://joinbot.tk/bot' diff --git a/README.md b/README.md index dfe2ddd..2632b60 100644 --- a/README.md +++ b/README.md @@ -9,3 +9,7 @@ Current Join Frontend Implementation for the Admin and User dashboards User: **user** Password: **any** +### Usefull Links: + +https://botpress.io/docs/tutorials/webchat-embedding + diff --git a/src/views/chatbot/index.vue b/src/views/chatbot/index.vue index c806d77..f3f0c23 100644 --- a/src/views/chatbot/index.vue +++ b/src/views/chatbot/index.vue @@ -9,9 +9,15 @@ export default { name: 'Chatbot', components: { }, data() { + return {} }, mounted: () => { - window.botpressWebChat.init({ host: 'http://localhost:3000', botId: 'joinbot' }) + window.botpressWebChat.init({ host: process.env.BOTPRESS_HOST, botId: 'joinbot', enableReset: false, + enableTranscriptDownload: false, + hideWidget: true, + extraStylesheet: '/assets/modules/channel-web/chat.css', + botName: 'Joe' + }) setTimeout(() => { window.botpressWebChat.sendEvent({ type: 'show', @@ -20,6 +26,9 @@ export default { // window.botpressWebChat.sendEvent({ type: 'message', text: 'Hallo!' }) }, 1500) }, + beforeDestroy: () => { + document.getElementById('bp-widget').parentElement.removeChild(document.getElementById('bp-widget')) + }, methods: { } @@ -48,11 +57,14 @@ export default {