Send a custom Agent Welcome Message in Salesforce Enhanced Channel
Oct 14, 2025
Show More Show Less
View Video Transcript
0:04
Hello everyone. In this video, we are
0:07
going to see how to automatically send a
0:11
welcome message when an agent accepts
0:15
Salesforce messaging session record. If
0:18
you are using enhanced uh channels like
0:23
messaging for uh inapp and web now it is
0:26
called as enhanced chat or uh SMS
0:29
channel, WhatsApp channel, Facebook
0:31
channel or Apple for messenger channel.
0:34
For all these uh channels
0:38
we make use of messaging session object
0:41
or entity.
0:44
These uh messaging session records are
0:46
routed to the agents via omni channel.
0:50
If you wanted to automate and send a
0:53
welcome message
0:55
as an agent, we can make use of
1:00
lightning web component. And in the
1:02
lightning web component we can make use
1:05
of
1:08
conversation toolkit API from in this
1:12
particular library lightning uh/
1:14
conversation toolkit API. We can make
1:16
use of send text message method. There
1:20
is also another uh method called set
1:23
text message. you you in instead of
1:26
automatically send it, it will populate
1:29
the text in the conversation pane so
1:32
that the agent can review it and then
1:34
they can click send button or enter
1:36
button to send it. So based on your use
1:38
case, you can make use of set text
1:40
message or send text message. In this
1:43
video, I am making use of send text
1:46
message because my use case is to
1:48
automatically send the welcome message
1:50
once the agent receives the messaging
1:54
session record.
1:56
So this is the lightning web component.
1:57
I didn't add anything in the HTML
1:59
because I'm going to just automate auto
2:02
automatically send the message.
2:06
Um so I'm using RTP record ID so that I
2:09
will have the messaging session record
2:11
ID here.
2:15
And I'm making use of user ID here uh
2:18
for the get record. And then I'm getting
2:20
the name field.
2:23
So I wanted to get the logged in agent
2:26
name. So I'm making use of name field
2:28
from the user object
2:31
and I'm making use of get record from
2:33
the lightning UI record API library.
2:40
So I'm get I'm I'm getting the user and
2:42
then I'm getting what is the value in
2:43
the name field. So if my uh name is uh
2:48
admin user once I log in if I accept the
2:53
message I will be able to get my name as
2:55
admin user. In the connected call back I
3:00
am using set timeout. uh I'm making use
3:03
of set timeout so that everything will
3:05
be loaded in my lightning uh record page
3:09
so that after 2 seconds of delay once
3:12
everything is loaded it will um call the
3:17
send message. So in this send a message
3:20
I'm making use of send text message from
3:23
the conversation toolkit API library and
3:26
then I'm setting the record ID and then
3:28
also I'm setting the
3:31
text message that has to be
3:33
automatically sent. So I'm setting the
3:36
text as welcome to infallible tech
3:38
support. My name is the name of the
3:41
loggedin agent
3:43
um full stop space how can I help you?
3:49
I am making use of lightning record page
3:51
as the target so that I can add it on
3:54
the messaging session lightning record
3:56
page. So here I have added the welcome
3:58
message lightning web component. In the
4:01
filter I have set status should be equal
4:04
to active. So whenever an agent accepts
4:08
the messaging session record the status
4:10
of the um messaging session will be
4:14
active.
4:15
So I'm setting the filter as active. If
4:18
it is not active, I don't want to load
4:20
the lightning web component and do
4:21
unnecessary calls.
4:25
Let's uh test this out. So I'm going to
4:28
test from my embedded service
4:30
deployment. As an agent, I'm going to
4:34
login into Omni channel.
4:38
As an end user, I'm going to initiate a
4:41
enhanced chart session.
4:46
So here as an agent I'm going to accept
4:49
the messaging session.
4:51
Immediately after 2 seconds delay it
4:55
automatically sent a message saying that
4:57
welcome to infallible tech. My name is
4:59
Maruland Pandy. How can I help you? It
5:02
sent this message from this lightning
5:06
web component.
5:11
So as an end user I was able to receive
5:13
it. We can make use of uh messaging
5:17
components and then we can set it in the
5:21
messaging channel also. But here
5:24
in order to have more uh uh
5:27
customization because in the messaging
5:29
components I will not be able to call
5:31
apex. Uh but here with the lightning web
5:34
component I will be able to invoke apex
5:37
method. Uh so in order to do some
5:40
complex welcome message uh um
5:43
development you can make use of this
5:45
approach.
5:49
One important thing to note here is
5:51
let's say I am transferring this
5:53
messaging session. If I transfer once
5:56
the other agents receives it it will
5:59
again send this message with that
6:01
particular agent's name. So if you
6:04
wanted to avoid um duplicate uh uh
6:08
messages, make sure you are not making
6:10
use of this approach. Also, if I refresh
6:14
this page, usually the recommendation
6:17
whenever we use service console is not
6:19
to re um not to refresh the page. So if
6:22
the agents by mistake uh reload the uh
6:26
page, it will again send the message.
6:31
So there are some pros and cons with
6:33
this approach. If the agents are
6:36
following the best practices and if your
6:39
use case is very complex and then if if
6:41
it is a hard requirement they can then
6:43
you can definitely make use of this
6:45
lightning web component to automatically
6:47
send the uh complex welcome message.
6:56
Please check the video description. In
6:58
the video description, I have shared my
6:59
blog post. From the blog post, you
7:01
should be able to get the sample
7:03
lightning web component code that was
7:05
referenced in this video.
7:12
I hope it was helpful.
7:18
Thank you for watching.
#Email & Messaging
#Internet Software
#Text & Instant Messaging