Skip to main content

JavaScript

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

The SDK is compatible with Node.js, and can be used in browsers with a module bundler such as Browserify or Webpack.

const TalonOne = require("talon_one");
const defaultClient = TalonOne.ApiClient.instance;defaultClient.basePath = "https://mycompany.talon.one";
// Configure API key authorization: api_key_v1const 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 updateconst 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);    }  );