Webchat
Routing Webchat Traffic
Setting up the webchat notification system
Choosing a routing method
The reason you route traffic is so that you are able to boot the conversation up in new stubs, with each stub running an instance of your default webchat template.
There are two methods for routing the webchat traffic:
- Direct to stub using Stubref
- Heimdal method
Here are some considerations when chosing your routing method:
- The routing method you choose will depend on your use case. Direct to stub will fit most use cases.
- Heimdall should be used for webchat's that experience high traffic (e.g webchat's on a website homepage)
- Heimdall is flexible but difficult to setup and understand for new users.
- Direct to stub is quick and easy to setup.
Option 1 : Routing webchat traffic via Stubref
This is the preferred option for a simple webchat setup
- First messages of users are directly sent to a stubref you will create in the create context.
- Webchat data received directly is placed in
stub.data._incoming_webchat_data
- The default action that is executed on a stub is
_update_from_webchat
Option 2 : Routing webchat traffic via Heimdall
- Using heimdall you can listen to events from all webchat clients.
- Webchat data received from heimdall is placed in
stub.data.heimdall.webchat
. - There are multiple events you can listen to on heimdall but the most important event is
firstmessage
. - The
firstmessage
event fires when a user sends a webchat message. - Create the heimdall registration
stubber.systems.notifications.webchat.org.{{stub.orguuid}}.name.new_webchat_profile.webchatmessagetype.firstmessage