Hey there! Here's what you need to know to get started.
Create an API Key
Api Token are used to authenticate requests to the LOGSH API.
To create as many API Keys as you need go to the Logsh Dashboard.
Navigate to the "API Keys" section and click on "Create".
Give your key a name and start using it.
Api Key Example
logsh_1234567890qwertyuiopasdfghjklzxcvbnm
You need to send your API key as Bearer token in the Authorization header
Create a Workspace
A workspace is a container for your events. You can create multiple workspaces to organize your events.
To create a workspace, go to the Logsh Dashboard and navigate to the "Workspaces" section and click on "Create". Give it a name, and you're all set!
Tracking your first Event
Now that you have your workspace and API token, you're ready to track your first event!
You can do this by making a POST request to the Logsh API.
JavaScript example
export const sendLogshEvent = async ( data ) => { const response = await fetch( 'https://logsh.co/api/event', { method: 'POST', headers: { 'Content-Type': 'application/json', // Replace <YOUR_API_KEY> with your actual API Key 'Authorization': 'Bearer <YOUR_API_KEY>', }, body: JSON.stringify({ // Your workspace name workspace: data.workspace, // Event name event: data.event, // Event description description: data.description, // Event icon (optional) icon: data.icon, // Whether to send a push notification (optional) notify: data.notify, // Additional metadata for the event (optional) metadata: data.metadata, }), } ) const result = await response.json(); if( !response.ok ) { throw new Error(result.message || 'Failed to send event to Logsh'); } }
Send an event to logsh.co
That's it! You've successfully tracked your first event with Logsh.