Remove Salesforce Messaging for In App and Web Components from a Web Page
2K views
Jan 24, 2025
embeddedservice_bootstrap.utilAPI.removeAllComponents() can be used to remove all the Messaging for Web components from a page on our website. Blog Post: https://www.infallibletechie.com/2025/01/remove-salesforce-messaging-for-in-app-and-web-components-from-a-web-page.html
View Video Transcript
0:06
hello everyone in this video we are
0:08
going to see how to remove Salesforce
0:11
messaging for inapp and web components
0:14
from a web
0:15
page let's say you wanted to remove all
0:20
the JavaScript uh related uh components
0:24
that were added in your web page as part
0:27
of Salesforce messaging for inapp and
0:29
web
0:31
um I have a use case here in this blog
0:34
post and we are going to see the same
0:36
thing in the demo
0:38
also whenever the chat is
0:42
ended it has to completely remove all
0:45
the
0:46
messaging components which were added as
0:49
part of messaging for inapp and web in
0:51
my web page so for that I'm making use
0:55
of embedded servicecore bootstrap do
0:59
util AP a. remove all components method
1:02
this will remove all the components that
1:04
were loaded in your web page as part of
1:07
messaging for web
1:13
feature I am adding an event listener
1:17
for embed messaging conversation closed
1:19
so whenever the conversation is
1:21
ended it will fire this event once the
1:25
event is ended it will add this
1:27
console.log statement and then it will
1:30
uh invoke the clear session method which
1:34
will remove uh if you are using user
1:37
verification it will remove that session
1:40
after that it will remove all the
1:42
components which are related to
1:44
messaging for web in your web page using
1:47
this embeded servicecore bootstrap do
1:50
util do util api. remove all components
1:55
I have added couple of console.log
1:57
statements to verify that they are
2:00
loading uh correctly for
2:02
me next you have to add this sample
2:06
piece of code before the embeded
2:09
servicecore bootstrap doin
2:12
method when you create Salesforce
2:14
messaging for inapp and web embedded
2:16
service deployment you will get the code
2:18
snippet from Salesforce org in that
2:22
particular code snippet you have to add
2:24
this additional event
2:25
listener so that it will listen to the
2:28
conversation end event whenever the
2:30
conversation is ended it will clear the
2:32
session and then it will remove all the
2:35
components using remove all
2:38
components let's see a demo of
2:42
this I'm initiating a messaging for web
2:51
session it will go to my uh agent but
2:54
I'm not going to test it as an agent
2:57
once I end the session
3:04
it went inside the event listener it uh
3:08
added the console.log statement it
3:11
removed all the components and then
3:14
added one more console.log statements
3:16
after the clear uh remove all uh method
3:19
invocation so now I don't see the chat
3:23
widget also here to initiate it so make
3:26
a note of it whenever you want to
3:28
completely remove all the
3:30
messaging for web related messaging
3:33
components that were added in your web
3:35
page you can make use of embedded
3:37
servicecore bootstrap do util api.
3:41
remove all
3:48
components please check the video
3:50
description in the video description I
3:52
have shared my block post from the Block
3:55
post you should be able to get the
3:56
sample code for your reference
4:04
this particular feature is uh available
4:08
starting spring 25 release of
4:16
Salesforce I hope it was
4:25
helpful thank you for
4:28
watching e
#Internet Software