Skip to content

Webhook

The module allows you to create subscriptions for events that occur in the Crowdin project or organization. It’s not necessary to subscribe to events every time after creating a new project, events will come from all resources allowed for the application.

index.js
const crowdinModule = require('@crowdin/app-project-module');
const app = crowdinModule.express();
const configuration = {
baseUrl: 'https://123.ngrok.io',
clientId: 'clientId',
clientSecret: 'clientSecret',
name: 'Sample App',
identifier: 'sample-app',
description: 'Sample App description',
dbFolder: __dirname,
imagePath: __dirname + '/' + 'logo.png',
webhooks: [
{
events: ['file.added', 'file.updated', 'file.deleted', 'file.reverted'],
callback({client, events, webhookContext}) {
console.log('File events:', events);
}
}
]
}
const crowdinApp = crowdinModule.addCrowdinEndpoints(app, configuration);
app.listen(3000, () => console.log('Crowdin app started'));
Parameter
Description
eventsList of events to subscribe the application. See available events.
callbackThis function is called when the app receives events.
  • client - Crowdin API client.
  • events - Array of webhook event objects.
  • webhookContext - Object containing webhook context information:
    • domain - Crowdin domain
    • organizationId - Organization ID
    • userId - User ID (user who installed the application)
    • agentId - Agent ID (if authenticationType is crowdin_agent)