Webhooks are user-defined HTTP callbacks, which can be maintained, modified and managed by any third-party users, in order to cause events on one site to invoke behavior on another.
Webhooks can be called from anywhere. They can be added in a GitLab repo's settings, to be called by one or more events taking place in the repo at a given time. If the webhook is added to GitLab, its operations will take effect every time the selected event takes place, regardless of the branch determining the event.
When the webhook is triggered, the assigned languages/projects on POEditor receive data from the GitLab file that is connected to it.
- api_token (required) - you can get this key from your POEditor account. You'll find it in My Account > API Access.
- id_project (required) - the id of project. You'll find it in My Account > API Access.
- language (required) - language code. You'll find it in My Account > API Access.
- operation (required) - can be one of the following:
- get_terms - brings the terms from connected file on GitLab to the POEditor project
- import_translations - brings the translations from the file on GitLab repo to the linked language in the POEditor project
- import_terms_and_translations - brings new terms from the file on GitLab repo to the POEditor project, also adding translations to the linked language
- export_terms_and_translations - sends terms and translations from POEditor to the linked file on GitLab
- sync_terms_and_translations - gets the terms and translations from GitLab repo and removes obsolete terms from POEditor
- overwrite_translations (optional) - when importing translations to POEditor, set it to 1 in order to overwrite existing translations
In the GitLab integration page, you can find a webhook generator.
Linking multiple files to a language
Webhooks work on a project / language basis. So, if you have several files linked to a language, it's enough to run one webhook with an operation and that operation will be executed for all the files linked to that language.
We strongly recommend that you do not use the sync webhook if you have multiple files linked to the source language. The sync webhook deletes the terms which are in the project, but are not in the connected file. So you may end up losing terms you imported from other files. The terms from the file last synced is what remains in your POEditor project.
Notes: 1) The export option can be triggered from anywhere, except GitLab.
2) How your webhook behaves is determined by how you set it up in the integration page, in the Settings of each linked language.