Injecting Multiple Contacts into a Journey via API in Salesforce Marketing Cloud: Experimental Endpoint

It is pretty straightforward when you want to inject a contact into a journey via API. All you have to do is create a Journey with an API entry event and follow the documentation here.


The problem with this is you can inject only one contact per each API call. The question that's frequently asked is if we can inject many contacts into a journey in a single call. Well, the official answer is no.


Having said that, there is an experimental endpoint that can be used to do this. It works up to 500 contacts per batch. The code snippet below shows how to inject multiple contacts into a journey in a single API call using an experimental endpoint. 

 

Note that this is not documented officially and can stop working anytime. Also, legacy authentication is needed for this. Refer to the documentation here to request tokens for legacy packages.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com
POST /interaction-experimental/v1/batchcontactevents
Content-Type: application/json
Authorization: Bearer YOUR_V1_ACCESS_TOKEN

{
 "EventDefinitionKey": "APIEvent-ba36f8e9-12d5-af97-b263-8c169fc90643",
 "RecordCount": 2,
 "BatchDetails": [
 {
 "Data": {
 "subscriberKey": 
 "Sravalapart564hi@yopmail.com" ,
 "Email": "Sravalapart564hi@yopmail.com" 
 },

 "contactKey": "3124121235"

 },
 {
 "Data": {
 "subscriberKey": 
 "Sravalapart564hi@yopmail.com" ,
 "Email": "Sravalapart564hi@yopmail.com" 
 },

 "contactKey": "235123"

 }
]
}

No comments:

Post a Comment

Powered by Blogger.