How to fire a journey interaction event via FuelSDK-CSharp?

122 Views Asked by At

So my vendor has this event for me to call, members like ContactKey, EventDefinitionKey and Data.

But I cannot find anywhere a class suffice this, not in sample project not in documents. Only an internal class called "ContactEvent" looks similar but not accessible from outside.

Details:

POST /interaction/v1/events

  • Fires the entry event that initiates the journey.

JSON Parameters:

  • ContactKey
  • EventDefinitionKey
  • Data
1

There are 1 best solutions below

0
On

so far established a work around by using RESTful calls, using ETClient's authToken in header, something like following. but this won't be optimal, for one thing if we put this in an API service, the overhead to create new ETClient for every incoming request is not ideal, need to have some check logic of token expiration associated with refresh calls.........

            ETClient eTClient = new ETClient();
            using (var client = new HttpClient())
            {
                var request_json = System.IO.File.ReadAllText(@"C:\temp\RequestBody.txt");


                var url = "https://xxxxxxxxxx.rest.marketingcloudapis.com/interaction/v1/events";
                client.DefaultRequestHeaders.Add("Authorization", "Bearer " + eTClient.AuthToken);
                var content = new StringContent(request_json, Encoding.UTF8, "application/json");                    
                
                var response = client.PostAsync(url, content);
                System.Console.WriteLine(response.Result);                   
                
            }