Select Page

Knowledge

Webhook Calls

Webhooks are user-defined HTTP callbacks that are triggered by specific events. Whenever that trigger event occurs, the client API sees the event, collects the data, and immediately sends a notification (HTTP request) to the Webhook URL specified by the application.

To get the data from external applications using this webhook url you need to create a workflow with POST block and provide the workflow url to the external application to deliver the data as it happens and pass it to the subsequent block

After creating the workflow, get the workflow url from Copy URL action and provide it to the external application.

Access Keys

Access keys are used to access the ShuffleExchange API endpoint with Authentication. To create the key click on the Create button in the Access Keys section and provide the details like name and project which requires authentication and then click on create.

Now create a workflow with a POST block to get the data from an external application in a secured way and pass the data to the subsequent blocks. In the post block uncheck the “Enable Anonymous Access” to access the flow in a secured way by using the access keys.

Consume the Shuffle Exchange API

Below are the details which are required to consume the ShuffleExchange api using the above access key details.. First you need to get the access token and then call the API using the access token.

  1. Getting access token using Client Id and Client secret
    • Nuget package:
    • IdentityModel

C# Code snippet :

var client = new HttpClient();

var authDiscoveryDetails = await client.GetDiscoveryDocumentAsync(
“https://seauth.shuffleexchange.com”);

if (authDiscoveryDetails.IsError)

{

Console.WriteLine(authDiscoveryDetails.Error);

}

var tokenResponse = await

client.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest

{

Address = authDiscoveryDetails.TokenEndpoint,

 

ClientId = “ClientId”,

ClientSecret = “ClientSecret”,

});

if (tokenResponse.IsError)

{

Console.WriteLine(tokenResponse.Error);

return;

}

Console.WriteLine(tokenResponse.Json);

1. Calling API Endpoint with access token.

C# Code snippet :

var clientApiCall = new HttpClient();

clientApiCall.SetBearerToken(tokenResponse.AccessToken);

var workflowInput = “{Provide the Input data which accepts by the endpoint}”

var response = await clientApiCall.PostAsync(“https://seconnect.shuffleexchange.com/api2/c5e450ab-246e-4e27-b20e-853d9ba1f0b6/{ProjectName}/{workflowname}”, data);

if (!response.IsSuccessStatusCode)

{

Console.WriteLine(response.StatusCode);

}

else

{

 

var content = await response.Content.ReadAsStringAsync();

Console.WriteLine(content);

}