async function trackEvents()

in src/GetSentiment/getSentiment.js [6:24]


async function trackEvents(keys, events) {
  const body = JSON.stringify({
    keys: keys,
    events: events
  });

  const karteApiURL = `https://${process.env.KARTEApiHostname}/v2/track/event/write`
  const authorizationHeader = `Bearer ${process.env.KARTEAccessToken}`;

  const headers = {
    'Content-Type': 'application/json; charset=utf-8',
    'Authorization': authorizationHeader
  };
  
  return await axios.post(karteApiURL,
    body, {
    headers,
  });
}