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
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, credentials, events}) { console.log('File events:', events); } } ]}const crowdinApp = crowdinModule.addCrowdinEndpoints(app, configuration);
app.listen(3000, () => console.log('Crowdin app started'));
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
Parameters
credentials
- Crowdin API credentials.client
- Crowdin API client.events
- Array of webhook event objects.