// Replace these variables with the actual data retrieved from Thought Industries
const accountId = "210018";
const accountSignupDate = 1566932390; // Unix timestamp of account signup date
const accountPurchaseDate = 1566932395; // Unix timestamp of account purchase date
const accountPlanTier = "Standard"; // Account's plan tier
const accountCompanyName = "CoolCo"; // Account's name
const accountMRR = 599; // Account's monthly recurring revenue
const accountRenewalDate = "06202035"; // US timestamp of upcoming account renewal date
const accountManager = "Jerry"; // Account manager
// Construct the data object to send to Appcues
const dataToSend = {
accountId: accountId,
createdAt: accountSignupDate,
purchasedAt: accountPurchaseDate,
planTier: accountPlanTier,
companyName: accountCompanyName,
MRR: accountMRR,
renewalDate: accountRenewalDate,
accountManager: accountManager
};
// Send the data to Appcues using their API
fetch('https://api.appcues.com/v1/groups', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': '90d231a9-7608-4086-b34b-6be31c0d7dbb' // Replace YOUR_APPCUES_API_KEY with your actual API key
},
body: JSON.stringify({
groupId: "de6dd755-3004-4271-b1ae-0d4c39272393", // unique, required
properties: dataToSend
})
})
.then(response => {
if (!response.ok) {
throw new Error('Failed to send data to Appcues');
}
console.log('Data sent to Appcues successfully');
})
.catch(error => {
console.error('Error:', error);
});