Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

how to fire an interaction/event send #90

Open
lee0sun opened this issue Nov 26, 2020 · 1 comment
Open

how to fire an interaction/event send #90

lee0sun opened this issue Nov 26, 2020 · 1 comment

Comments

@lee0sun
Copy link

lee0sun commented Nov 26, 2020

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.

Kindly please help.

Details:

POST /interaction/v1/events | Fires the entry event that initiates the journey.
JSON Parameters
ContactKey
EventDefinitionKey
Data

@lee0sun lee0sun changed the title how to fire an event send how to fire an interaction/event send Nov 26, 2020
@lee0sun
Copy link
Author

lee0sun commented Nov 27, 2020

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);                   
        
        }   

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant