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:
Davidson Gomes
2024-07-15 12:43:20 -03:00
parent 22a24b1b88
commit a03ce984f6
6 changed files with 58 additions and 23 deletions

View 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);
});
};