// 1) 토큰 발급
const authRes = await fetch("https://api.notifly.tech/authenticate", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
accessKey: "your-access-key",
secretKey: "your-secret-key"
})
});
const { data: authToken } = await authRes.json();
// 2) API 호출
const res = await fetch("https://api.notifly.tech/track-event", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": authToken
},
body: JSON.stringify({
projectId: "your-project-id",
eventName: "view_home",
isGlobalEvent: false,
userId: "alice",
eventParams: { plan: "premium" }
})
});
console.log(await res.json());