Hi there! I'm trying to send analytics events from...
# community-help
j
Hi there! I'm trying to send analytics events from a typescript app using this code:
Copy code
const response = await fetch(
    `${env.TYPESENSE_PROTOCOL}://${env.TYPESENSE_HOST}:${env.TYPESENSE_PORT}/analytics/events`,
    {
      method: "POST",
      headers: {
        "X-TYPESENSE-API-KEY": env.TYPESENSE_API_KEY,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        type: event,
        name: eventTypeToEventName[event],
        data: {
          doc_id: documentId,
        },
      }),
    },
  );
but I'm getting an error