opendialogai / webchat
Webchat front end component for the Open Dialog project
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 12 696
Dependents: 0
Suggesters: 0
Security: 0
Stars: 15
Watchers: 8
Forks: 4
Open Issues: 11
Language:CSS
Requires
- php: ^8.1
- genealabs/laravel-caffeine: ^9.0
- illuminate/contracts: ^9.43
Requires (Dev)
- opendialogai/core: 1.x-dev
- orchestra/testbench: ^7.15.0
- phpunit/phpunit: ^9.0
- squizlabs/php_codesniffer: ^3.4
- 1.x-dev
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.0
- 1.14.0
- 1.13.0
- 1.12.0
- 1.11.0
- 1.10.0
- 1.9.6
- 1.9.5
- 1.9.4
- 1.9.3
- 1.9.2
- 1.9.1
- 1.9.0
- 1.8.1
- 1.8.0
- 1.7.4
- 1.7.3
- 1.7.2
- 1.7.1
- 1.7.0
- 1.6.0
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.0
- 1.1.0
- 1.0.2
- 1.0.1
- 1.0.0
- 1.0.0-beta.1
- 1.0.0-beta.0
- 1.0.0-alpha.1
- 1.0.0-alpha.0
- 0.7.x-dev
- 0.7.7
- 0.7.6
- 0.7.5
- 0.7.4.1
- 0.7.4
- 0.7.3
- 0.7.2
- 0.7.1.5
- 0.7.1.4
- 0.7.1.3
- 0.7.1.2
- 0.7.1.1
- 0.7.1
- 0.7.0
- 0.6.8
- 0.6.7
- 0.6.6
- 0.6.5
- 0.6.4
- 0.6.3
- 0.6.2
- 0.6.1
- 0.6.0
- 0.5.6
- 0.5.5
- 0.5.4
- 0.5.3
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.1
- 0.4.0
- dev-feature/OPNDLG-conversation-handover
- dev-feature/ONW-30__interface-settings
- dev-fix/format_date_in_user_lang
- dev-feature/ODTR-150_error_response_message_translation
- dev-feature/ODTR-142_form_validation_messages_translations
- dev-feature/updates_use_web_sockets_setting
- dev-fix/pusher_channel_test
- dev-fix/date-picker-fix
- dev-snyk-fix-864eb26fb4742a9c3d69470672ebc8e6
- dev-feature/OPNDLG-1842
- dev-feature/php8.1
- dev-dependabot/npm_and_yarn/yaml-and-release-it--removed
- dev-feature/ODPS-4__upload-message
- dev-feature/laravel-10
- dev-dependabot/npm_and_yarn/vm2-3.9.15
- dev-bug/ODTR-133_iframe_query_param
- dev-dependabot/npm_and_yarn/scss-tokenizer-and-node-sass-0.4.3
- dev-dependabot/npm_and_yarn/parse-path-and-release-it-7.0.0
- dev-dependabot/npm_and_yarn/loader-utils-and-loader-utils-and-resolve-url-loader-2.0.4
- dev-dependabot/npm_and_yarn/terser-and-laravel-mix-5.16.8
- dev-dependabot/npm_and_yarn/decode-uri-component-0.2.2
- dev-dependabot/npm_and_yarn/json5-1.0.2
- dev-dependabot/npm_and_yarn/http-cache-semantics-4.1.1
- dev-dependabot/npm_and_yarn/vm2-3.9.14
- dev-feature/ODTR-124_config_for_default_scenario_base_language
- dev-feature/ODTR-113__user-lang-for-datetime-messages
- dev-feature/ODTR-48_update_webchat_config
- dev-feature/ODTR-24__lang-negotiation
- dev-shift-76008
- dev-feature/ODTR-21_interface_settings_translations
- dev-rc/1.12.0
- dev-fix/show-close-chat-button
- dev-feature/avoid-iframe-session-storage
- dev-feature/ODTR-18_options_message_type
- dev-spike/avoid_iframe_session_storage
- dev-dependabot/npm_and_yarn/express-4.18.2
- dev-feature/OPNDLG-1698-changing-scenario-bug
- dev-dependabot/npm_and_yarn/qs-6.5.3
- dev-dependabot/npm_and_yarn/minimatch-3.0.8
- dev-snyk-upgrade-2f3241c9315d9a060016b93fbead90d8
- dev-feature/OPNDLG-1696-scenario-alias
- dev-feature/od-support-bot
- dev-rc/1.10.0
- dev-spike/OPNDLG-1636-scenario-id-alias
- dev-fix/core-composite-collection
- dev-fix/OPNDLG-1688_escape_autocompelte_options
- dev-fix/OPNDLG-1666_sends_request_id_for_preview
- dev-feature/update-core
- dev-rc/1.9.4
- dev-dependabot/composer/guzzlehttp/guzzle-7.5.x-dev
- dev-fix/remove-text-message-meta
- dev-dependabot/npm_and_yarn/moment-2.29.4
- dev-feature/audio-message
- dev-fix/pusher-channel-name
- dev-dependabot/npm_and_yarn/parse-url-6.0.2
- dev-rc/1.9.1
- dev-bug/form-message-history
- dev-rc/1.9.0
- dev-fix/remove_request_id_from_meta
- dev-feature/additional-meta-updates
- dev-fix/remove-hand-to-system-error
- dev-feature/PEP-49_webchat_sockets
- dev-dependabot/npm_and_yarn/eventsource-1.1.1
- dev-feature/OPNDLG-1552_add_ipinfo_token
- dev-fix/OPNDLG-1530-disabled-input
- dev-feature/right-to-left-support
- dev-feature/escalating-triggers
- dev-spike/audio-message
- dev-fix/OPNDLG-1168-fp-form-cancel-color
- dev-fix/OPNDLG-1393-autocomplete-selected-option
- dev-fix/OPNDLG-950-cta-color
- dev-feature/OPNDLG-1514-make-route-registration-configurable
- dev-fix/OPNDLG-1518_links_in_messages
- dev-feature/circleci_notifications_update
- dev-fix/OPNDLG-1483_form_message_checkbox
- dev-dependabot/npm_and_yarn/url-parse-1.5.10
- dev-dependabot/npm_and_yarn/url-parse-1.5.7
- dev-bud/OPNDLG-1454_fix_typing_indicator
- dev-feature-add-webchat-licence
- dev-feature/send-chat-open-response-event
- dev-feature/OPNDLG-721
- dev-feature/code-of-conduct
- dev-feature/add-apache-2-license-file
- dev-master
This package is auto-updated.
Last update: 2023-07-11 13:52:56 UTC
README
This is the OpenDialog webchat package that contains the vue based webchat bot and APIs and database config for webchat settings.
Setting up for Local Development
This application is intended to be worked on using the OpenDialog Development Environment
Please follow instructions there for setting up the containers. Tests should be run from within the workspace
container.
Running Code Sniffer
To run code sniffer, run the following command
./vendor/bin/phpcs --standard=od-cs-ruleset.xml src/ --ignore=*/migrations/*,*/tests/*
Git Hooks
To set up the included git pre-commit hook, first make sure the pre-commit script is executable by running
chmod +x .githooks/pre-commit
Then configure your local git to use this directory for git hooks by running:
git config core.hooksPath .githooks/
Now every commit you make will trigger php codesniffer to run. If there is a problem with the formatting of the code, the script will echo the output of php codesniffer. If there are no issues, the commit will go into git.
Steps to use this package in an application
Composer set up
To install using Composer run the following command:
composer require opendialogai/webchat
Building Front End Assets
CI build of assets
This project has been set up so that css
, js
and image
assets are not pushed from the developers machine (they are
part of .gitignore
to make sure). Instead, they are built and pushed by the
CI process on each commit.
To ignore local changes to built assets, please run:
git update-index --assume-unchanged public/css/app.css public/css/app-fullpage.css public/css/app-iframe.css public/css/main.css public/js/app.js public/js/opendialog-bot.js public/js/opendialog-bot-full.js
Manual build of assets
To build assets whist developing follow this process:
-
Change to the
vendor/opendialog/webchat-frontend
directory and runyarn install; yarn dev
(for development) -
Run
php artisan vendor:publish --tag=public --force
to move the newly built assets into the parent application to be served
Publishing migration files
Migration files need to be published before they can be applied to an OpenDialog app's database.
To publish the migrations, run:
php artisan vendor:publish --tag="od-webchat-migrations"
This relies on the MULTI_TENANT
env having been set to true in the app's .env
file if being run as a
multi-tenant system to ensure the migrations end up in the right place
Configuration
The webchat configuration can be found in the webchat_settings
table. Before running, the config table should be seeded
by running:
php artisan webchat:settings
This will load a row for each available setting.
Config items can still be overwritten in the openDialogSettings
javascript variable that is added to the parent web page.
Features
Chat Open param
If the url of the page hosting the chatbot has the query param 'chat_open=true', the chat will load pre-opened
Callback ID of open event
When the chat window is opened, and default callback_id of welcome is sent along with the chat open event. This can be overridden by setting the 'callback_id' query param on the url of the page hosting the chatbot. Whatever value is set as the query param will be sent with the chat open event. It is then down to the user to set up a conversation that deals with that callback_id
Comments tab
The webchat widget can fetch comments from an endpoint matching the JSON:API spec. To enable comments, add a commentsEnabled parameter to openDialogSettings, set to true. You will additionally need to pass information about the comment entity name, author entity name, and section entity name. (If present)
Example config:
window.openDialogSettings = { url: "{{env('APP_URL')}}", user : { first_name: 'Jane', last_name: 'Smith', email: 'jane.smith@opendialog.ai', external_id: "{{ auth()->user()->id }}", }, comments: { commentsEnabled: true, commentsName: 'Comments', commentsAxiosConfig: { baseURL: 'http://localhost/json/', headers: { // eslint-disable-next-line no-undef Authorization: `Bearer {{ auth()->user()->api_token }}`, 'Content-Type': 'application/vnd.api+json', }, }, commentsEntityName: 'comments', commentsCreatedFieldName: 'created', commentsTextFieldName: 'comment', commentsAuthorEntityName: 'people', commentsAuthorRelationshipName: 'commentAuthor', commentsAuthorIdFieldName: 'id', commentsAuthorNameFieldName: 'name', commentsSectionEntityName: 'posts', commentsSectionRelationshipName: 'post', commentsSectionIdFieldName: 'id', commentsSectionNameFieldName: 'title', commentsSectionPathPattern: 'home\\\/posts\\\/(\\\d*)$', }, };