mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-20 04:12:23 -06:00
chore: Update telemetry and add new integrations
Refactored the telemetry guard to use a new sendTelemetry utility function, which allows for easier tracking of API routes. Also, added telemetry events for message sending in the Chatwoot and Typebot services. Additionally, updated the README.md to include new content creators and added new integrations with Typebot and Chatwoot services. Modified: - README.md - package.json - src/api/guards/telemetry.guard.ts - src/api/integrations/chatwoot/services/chatwoot.service.ts - src/api/integrations/typebot/services/typebot.service.ts Added: - src/utils/sendTelemetry.ts
This commit is contained in:
25
src/utils/sendTelemetry.ts
Normal file
25
src/utils/sendTelemetry.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import axios from 'axios';
|
||||
import fs from 'fs';
|
||||
|
||||
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
|
||||
|
||||
export interface TelemetryData {
|
||||
route: string;
|
||||
apiVersion: string;
|
||||
timestamp: Date;
|
||||
}
|
||||
|
||||
export const sendTelemetry = async (route: string): Promise<void> => {
|
||||
const telemetry: TelemetryData = {
|
||||
route,
|
||||
apiVersion: `${packageJson.version}`,
|
||||
timestamp: new Date(),
|
||||
};
|
||||
|
||||
axios
|
||||
.post('https://log.evolution-api.com/telemetry', telemetry)
|
||||
.then(() => {})
|
||||
.catch((error) => {
|
||||
console.error('Telemetry error', error);
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user