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.
Sample
Section titled “Sample”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'));Configuration
Section titled “Configuration”| Parameter | Description |
|---|---|
events | List of events to subscribe the application. See available events. |
callback | This function is called when the app receives events. |
callback Function
Section titled “callback Function”Parameters
Section titled “Parameters”client- Crowdin API client.events- Array of webhook event objects.webhookContext- Object containing webhook context information:domain- Crowdin domainorganizationId- Organization IDuserId- User ID (user who installed the application)agentId- Agent ID (ifauthenticationTypeiscrowdin_agent)