-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
22a24b1
commit a03ce98
Showing
6 changed files
with
58 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); | ||
}; |