Skip to main content

JavaScript

The JavaScript SDK supports all of the operations of the Integration API.

const TalonOne = require("talon_one");

const defaultClient = TalonOne.ApiClient.instance;
defaultClient.basePath = "https://mycompany.europe-west1.talon.one";

// Configure API key authorization: api_key_v1
const api_key_v1 = defaultClient.authentications["api_key_v1"];
api_key_v1.apiKey = "dbc644d33aa74d582bd9479c59e16f970fe13bf34a208c39d6c7fa7586968468";
api_key_v1.apiKeyPrefix = "ApiKey-v1";

// Integration API example to send a session update
const integrationApi = new TalonOne.IntegrationApi();
const customerSession = new TalonOne.NewCustomerSession();

customerSession.total = 100.33;
customerSession.coupon = "Cool-Summer!";

integrationApi
.updateCustomerSession("example_integration_id", customerSession)
.then(
function(data) {
console.log(JSON.stringify(data, null, 2));
},
function(error) {
console.error(error);
}
);