Show More Show Less
View Video Transcript
0:06
Hello everyone. In this video, we are
0:09
going to see how to send custom
0:12
notifications
0:13
whenever a messaging session record is
0:16
routed and as well as transferred.
0:19
The use case uh I had was
0:23
uh I'm using Salesforce enhanced chat. I
0:26
am making use of version one of enhanced
0:29
chat and not version two. Uh this video
0:32
is all about version one of enhanced
0:34
chat not for version two.
0:39
Whenever
0:42
uh the messaging session record is
0:44
routed and as well as transferred
0:46
internally by the service
0:47
representatives. For example u I am a
0:50
representative. I got this uh Salesforce
0:53
messaging session record routed via omni
0:56
channel. I was uh inquiring the uh in
1:01
customer about some information and the
1:03
customer query is not related to my
1:06
expertise. So I wanted to transfer it.
1:09
Now whenever I transfer it, the use case
1:11
was to send some custom notification.
1:14
I'm not going to talk about the custom
1:16
notification how I configured um and
1:20
what are all the information we sent for
1:22
the custom transfer uh notification but
1:24
I'm going to tell how to do custom
1:27
notifications whenever a messaging
1:29
session record from the version one of
1:32
enhanced channel is routed and as well
1:34
as transferred. First let's see a demo
1:37
and then we will talk about the
1:39
technical implementation behind the
1:41
screen.
1:44
Okay.
1:46
So this is the site where my enhanced
1:48
chat version one is hosted.
1:51
I'm going to
1:54
initiate messaging session record.
1:58
I'm going to make myself available in
2:02
omni channel
2:04
as a service representative. I got the
2:07
messaging uh session record.
2:10
I'm going to say from user one
2:20
testing. Now before transferring when
2:24
the messaging session record was routed
2:27
it sent a message saying initial
2:29
transfer. This message was sent to the
2:34
user who started the messaging session.
2:37
This is a custom notification. I am
2:40
sending it now. I'm going to make myself
2:44
available in omni channel as uh user 2.
2:52
Okay, let me refresh the screen.
2:56
Okay, I'm going to mark myself available
2:59
in omni channel.
3:01
Now the user one is going to send a
3:04
message.
3:06
The end user received the message.
3:22
Okay. So, I'm able to see a message
3:24
demo. Now, I'm going to transfer this
3:28
internally
3:30
to the messaging session queue.
3:33
It got transferred.
3:37
I'm able to get
3:39
as uh then the the admin user the
3:43
different user
3:45
I can see subsequent transfer message
3:52
here this subsequent transfer is the
3:55
message that was sent uh on behalf of
3:59
the user. So this is the notification uh
4:02
that was sent so that the user will know
4:04
that they have subsequently transferred
4:06
and the user will come to know that the
4:08
message was transferred.
4:20
So this is a message from a different
4:23
user.
4:25
So initially
4:27
test you user joined he was able to
4:30
assist and next it was transferred and I
4:34
got the request and then I am able to
4:36
assist the customer. So with the help of
4:39
uh
4:47
on embedded messaging conversation
4:49
conversation routed event. I was able to
4:52
listen
4:54
whenever the messaging session record is
4:56
routed or transferred. Whenever the
4:59
messaging session record is routed or
5:01
transferred, this event will be fired.
5:04
When this event is fired, I am making
5:07
use of embedded service bootstrap. to
5:10
API dot send text me message method so
5:14
that I can send a custom message and I'm
5:17
making use of this as a notification to
5:20
the user.
5:23
Let's see the code behind it.
5:27
So this is the code we usually get it
5:29
from embedded service deployment code
5:31
snippet
5:33
here using window.adde add event
5:37
listener method I'm listening to on
5:40
embedded messaging conversation routed
5:42
event whenever this event is routed so
5:45
sorry whenever the event is fired
5:48
I am making use of the
5:52
information from the event
5:56
from that event
5:58
I'm getting the full information using
6:01
event detail
6:04
and from that event detail Okay, I'm
6:06
getting conversation entry dot entry
6:10
payload. From the entry payload,
6:13
I am parsing that and then I'm getting
6:15
the routing type. When the routing type
6:18
is initial, then I'm sending a message
6:21
saying initial transfer. If the routing
6:24
type is transfer, then I'm sending a
6:26
message subsequent transfer. So with the
6:29
help of on embedded messaging
6:32
conversation routed event
6:36
I am calling send a message to user
6:39
method. This is a custom JavaScript
6:41
method
6:43
which makes use of embedded service
6:45
bootstrap.utilapi
6:47
send text message
6:50
through which the message is sent. So it
6:53
will be sent as an end user so that they
6:55
will get notified that the messaging
6:58
session is routed initially or it is
7:01
subsequently transferred. So that
7:03
notification will be available for the
7:06
user instead of uh sending a message.
7:09
You can also make use of uh other uh uh
7:13
JavaScript methods like window.alert
7:15
alert and uh if you wanted to make use
7:18
of some fancy uh notification, you can
7:20
also make use of CSS uh custom CSS and
7:24
then you should be able to achieve it.
7:33
You should be able to see
7:38
the payload.
7:43
Initially the routing type
7:46
was initial.
7:49
Whenever it is transferred, the routing
7:51
type will be transfer.
7:59
Please check the video description. In
8:01
the video description, I have shared my
8:03
blog post. From the blog post, you
8:05
should be able to get the complete
8:07
JavaScript U code for your reference.
8:21
I hope it was helpful.
8:31
Thank you for watching.
