Bulk Delete Salesforce Messaging Users and Related Data via the Conversation Data API
Nov 20, 2025
How to Mass Delete Salesforce Messaging Users and Related Data via the Conversation Data API?
Show More Show Less View Video Transcript
0:07
Hello everyone. In this video, we are
0:10
going to see how to mass delete or bulk
0:13
delete Salesforce messaging users and
0:18
their related records
0:20
with the help of conversation data API.
0:26
I have seen in many Salesforce forums
0:30
for uh GDPR and CCPA
0:34
u they wanted to delete the Salesforce
0:37
messaging participants and their related
0:40
data uh from Salesforce. In order to do
0:43
so, we can make use of the Salesforce
0:46
conversation data API.
0:50
The prerequisite for this is in
0:54
Salesforce setup we have to enable
0:57
conversation service APIs. So in order
1:00
to do so go to Salesforce setup
1:05
search for
1:08
conversation service APIs
1:12
and enable this. Once this is enabled,
1:16
the next prerequisite for this is to
1:19
create external client app. So go to
1:23
external client app manager in
1:25
Salesforce. Click new external client
1:30
and then you have to follow all the
1:32
steps that are mentioned in this
1:34
document.
1:36
You have to create the external app with
1:40
all the scope. what are all the features
1:42
that should be enabled and disabled. So
1:45
make sure you follow all these steps.
1:48
Once we create this uh external client
1:51
application in Salesforce setup, we will
1:53
be able to get the consumer key and the
1:56
consumer secret so that we will be able
1:59
to make a call to the Salesforce access
2:01
token endpoint and get the access token.
2:04
So this particular uh yeah external
2:07
client app in Salesforce setup is
2:10
created mainly for the authentication
2:13
and uh in this authentication we are
2:15
defining the authorization the scope to
2:19
access Salesforce API platform.
2:23
Okay. Next,
2:26
once this uh once these prerequisites
2:29
are done uh in order to delete uh the
2:33
participant and their related data uh
2:35
for uh with the help of uh conversation
2:39
data API, we have to do uh HTTP get
2:43
request to get the access token. In
2:46
order to do that, use a post request
2:50
to your Salesforce my domain
2:52
URL/services
2:54
/2
2:56
/ token.
2:59
Here you have to pass your client ID,
3:01
secret and grant type. Once this is
3:03
done, you will be able to get the access
3:05
token.
3:07
So here I'm able to get the access token
3:10
with the help of client ID and client
3:12
secret from the external client app.
3:16
And I'm setting the grant type as client
3:19
credentials. And I'm able to get the
3:21
access token. You have to make use of
3:23
this access token in your next delete
3:27
request. In order to delete the
3:30
conversation participant and their
3:32
related data, you have to do a delete
3:35
request
3:37
to api.salforce.com/platform/engagement.
3:42
Current version is v v1.0. window /
3:46
conversation participants and in the
3:49
parameter you have to pass the
3:51
participant entity ID. Here you can pass
3:54
multiple participant ids at the same
3:56
time. Instead of passing one participant
3:59
ID at a time, you will be able to pass
4:01
multiple with comma separated. And uh
4:04
one more parameter what you have to pass
4:07
is cascade level equal to full cascade
4:10
so that it will delete all the
4:11
participant and their related data from
4:15
Salesforce. One one important thing to
4:18
note here is whenever we do this delete
4:20
request it will do
4:24
uh an an async operation. So what it
4:27
will do is it will encue the jobs for
4:30
deletion and it will gradually delete
4:33
the uh data and then you and in order to
4:36
verify it you can go to uh Salesforce
4:39
developer console and then you should be
4:40
able to uh query whether that messaging
4:43
user record is present or not. Let's see
4:46
how to get
4:48
these uh messaging user ids using
4:52
Salesforce Apex. In order to get um the
4:56
data, I am making use of this simple
5:00
Apex code, I'm getting ID from messaging
5:04
user object or entity with a limit of
5:06
three. This is my dev or a demo or I'm
5:09
just playing around. So I'm making I'm
5:12
going to get three messaging user ids
5:15
and then I'm printing it in my system.
5:17
Debbug statement. So I will be able to
5:19
get three messaging user ids using which
5:22
I will be able to uh pass it uh to the
5:26
delete request.
5:27
What I would recommend is use select ID
5:30
comma messaging user and use a bar
5:33
condition based on the user you wanted
5:35
to delete from your Salesforce or so
5:39
make use of this um query. I will try to
5:44
share this sample apex code in the blog
5:47
post. So you will be able to get the
5:49
sample SOQL and the sample Apex code for
5:51
your reference. Okay. So here I'm going
5:54
to execute this.
5:59
Let's look at the debug log. So here I'm
6:02
able to get three messaging user IDs.
6:06
Let me copy it. Currently
6:09
I have 21 messaging users.
6:13
I just clicked refresh twice. I can see
6:16
that 21 messaging user uh records are
6:19
there. Let me pass this.
6:22
Let me clear this response.
6:25
And here I'm going to pass three
6:30
messaging user ids. Now if I make a
6:32
request here in the param we have to
6:35
pass participant entity ID and cascade
6:37
level as full cascade. Next in the
6:40
header you have to pass authorization as
6:43
barer space. The access token which we
6:45
got it from the previous post request.
6:50
Okay. Now let me do this. Send request
6:53
delete request is encqed. I can see the
6:56
status as incqed.
7:00
Now if I go and refresh it as of now it
7:03
is 21. It should be 18. But since it is
7:06
async job, we have to give some time for
7:09
the jobs to be completed.
7:12
So as of now only one is deleted.
7:17
Let's give some time.
7:20
One more thing is if you go to recycle
7:22
bin,
7:24
you should be able to see the one which
7:27
got deleted. So the deleted date is
7:28
today 20th November 2025. So even here
7:33
if you refresh you you should see that
7:36
it it will take some time. It won't be
7:39
um it is not an synchronous uh job for
7:42
the deletion request. It will take its
7:44
time. So kindly uh wait for some time
7:47
and then you should be able to see the
7:49
deletion.
7:51
Please check the video description. In
7:53
the video description I have shared my
7:55
blog post. from the blog post you should
7:57
be able to get the prerequisites steps
8:01
sample apex code with the SOQL query for
8:04
your reference. Now let's verify whether
8:07
it is deleting it or not. Okay, see two
8:10
of them are also deleted. Now if I come
8:13
here check the recycle bin I'm able to
8:15
see the three records which were
8:17
deleted. Definitely it took couple of
8:19
minutes for the deletion. So if you are
8:21
deleting in bulk, kindly wait. It is not
8:23
a synchronous call. It is an
8:25
asynchronous operation. Salesforce will
8:27
delete and then it should be available
8:29
in your recycle bin. And then uh if you
8:32
want to restore it uh before the recycle
8:35
bin is purged, you should be able to
8:37
restore it.
8:41
I hope it was helpful.
8:47
Thank you for watching.
#Internet Software
