diff --git a/scripts/docs/fr/130.automation/020.webhook/fr-020.create-webhook.md b/scripts/docs/fr/130.automation/020.webhook/fr-020.create-webhook.md index e69de29bb2..97afadb9e5 100644 --- a/scripts/docs/fr/130.automation/020.webhook/fr-020.create-webhook.md +++ b/scripts/docs/fr/130.automation/020.webhook/fr-020.create-webhook.md @@ -0,0 +1,281 @@ +*** + +title : « Créer un webhook » +description: 'Apprenez à créer un webhook dans NocoDB.' +balises : \['Webhook', 'Créer'] +mots-clés : \['Webhook NocoDB', 'créer un webhook'] +--------------------------------------------------- + +## Créer un webhook + +### Accéder à la page du webhook + +1. Cliquez sur le tableau pour lequel le webhook doit être configuré dans la barre latérale gauche +2. Ouvrir `Details` barre d’onglets, +3. Cliquer sur `Webhooks` languette +4. Cliquez sur`Add New Webhook` + +![Accessing webhook](/img/v2/webhook/create-webhook-1.png) + +### Configuration du webhook + +1. Nom du webhook +2. Sélectionnez l'événement pour lequel le webhook doit être déclenché + +| Déclencheur | Détails | +|---------|----------------------------- ---------| +| Après l'insertion | Après l'insertion d'un seul enregistrement | +| Après la mise à jour | Après la mise à jour d'un seul enregistrement | +| Après suppression | Après la suppression d'un seul enregistrement | +| Après l'insertion en masse | Une fois les enregistrements groupés insérés | +| Après la mise à jour groupée | Une fois les enregistrements groupés mis à jour | +| Après la suppression groupée | Une fois les enregistrements groupés supprimés | + +3. Méthode et URL : configurez le point de terminaison sur lequel le webhook doit être déclenché. Les méthodes prises en charge sont GET, POST, DELETE, PUT, HEAD, PATCH +4. En-têtes et paramètres : configurer les en-têtes et les paramètres de la demande (facultatif) +5. Condition : seuls les enregistrements répondant aux critères configurés déclencheront le webhook (facultatif) +6. Testez le webhook (avec un exemple de charge utile) pour vérifier si les paramètres sont configurés correctement (facultatif) +7. Enregistrez le webhook + +![Configuring webhook](/img/v2/webhook/create-webhook-2.png) + +### Webhook avec conditions + +En cas de webhook avec conditions, seuls les enregistrements répondant aux critères configurés déclencheront le webhook. Par exemple, déclenchez le webhook uniquement lorsque `Status` est `Complete`. Vous pouvez également configurer plusieurs conditions à l'aide des opérateurs `AND` ou `OR`. Par exemple, déclenchez le webhook uniquement lorsque `Status` est `Complete` et `Priority` est `High`. + +Le Webhook sera déclenché uniquement lorsque la condition configurée n'est pas remplie avant la mise à jour de l'enregistrement. Par exemple, si vous avez configuré un webhook avec la condition`Status``is``Complete`et`Priority``is``High`et vous mettez à jour l'enregistrement avec`Status``Complete`et`Priority``Low`à`High`, le webhook sera déclenché. Cependant, si vous mettez à jour d'autres champs de l'enregistrement avec`Status``Complete`et`Priority``High`, webhook won't be triggered. + +En résumé, le webhook ne sera déclenché que lorsque`Condition(old-record) = false`et`Condition(new-record) = true`. + +### Exemple de réponse de webhook + + + + +```bash +{ + "type": "records.after.insert", + "id": "9dac1c54-b3be-49a1-a676-af388145fa8c", + "data": { + "table_id": "md_xzru7dcqrecc60", + "table_name": "Film", + "view_id": "vw_736wrpoas7tr0c", + "view_name": "Film", + "records": [ + { + "FilmId": 1011, + "Title": "FOO", + "Language": { + "LanguageId": 1, + "Name": "English" + }, + } + ] + } +} +``` + + + + +```bash +{ + "type": "records.after.update", + "id": "6a6ebfe4-b0b5-434e-b5d6-5212adbf82fa", + "data": { + "table_id": "md_xzru7dcqrecc60", + "table_name": "Film", + "view_id": "vw_736wrpoas7tr0c", + "view_name": "Film", + "previous_records": [ + { + "FilmId": 1, + "Title": "ACADEMY DINOSAUR", + "Description": "A Epic Drama of a Feminist in The Canadian Rockies", + "Actor List": [ + { + "ActorId": 10, + "FirstName": "CHRISTIAN" + } + ], + } + ], + "records": [ + { + "FilmId": 1, + "Title": "ACADEMY DINOSAUR (Edited)", + "Actor List": [ + { + "ActorId": 10, + "FirstName": "CHRISTIAN" + } + ], + } + ] + } +} +``` + + + + +```bash +{ + "type": "records.after.delete", + "id": "e593079f-70e5-4965-8944-5ff7aeed005c", + "data": { + "table_id": "md_xzru7dcqrecc60", + "table_name": "Film", + "view_id": "vw_736wrpoas7tr0c", + "view_name": "Film", + "records": [ + { + "FilmId": 1010, + "Title": "ALL-EDITED", + "Language": { + "LanguageId": 1, + "Name": "English" + }, + } + ] + } +} +``` + + + + +```bash +{ + "type": "records.after.bulkInsert", + "id": "f8397b06-a399-4a3a-b6b0-6d1c0c2f7578", + "data": { + "table_id": "md_xzru7dcqrecc60", + "table_name": "Film", + "view_id": "vw_3fq2e9q8drkblw", + "view_name": "GridView", + "records_inserted": 2 + } +} +``` + + + + +```bash +{ + "type": "records.after.bulkUpdate", + "id": "e983cea5-8e38-438e-96a0-048751f6830b", + "data": { + "table_id": "md_xzru7dcqrecc60", + "table_name": "Film", + "view_id": "vw_3fq2e9q8drkblw", + "view_name": "Sheet-1", + "previous_records": [ + [ + { + "FilmId": 1005, + "Title": "Q", + "Language": { + "LanguageId": 1, + "Name": "English" + }, + }, + { + "FilmId": 1004, + "Title": "P", + "Language": { + "LanguageId": 1, + "Name": "English" + } + } + ] + ], + "records": [ + [ + { + "FilmId": 1005, + "Title": "Q-EDITED", + "Language": { + "LanguageId": 1, + "Name": "English" + } + }, + { + "FilmId": 1004, + "Title": "P-EDITED", + "Language": { + "LanguageId": 1, + "Name": "English" + }, + } + ] + ] + } +} +``` + + + + +```bash +{ + "type": "records.after.bulkDelete", + "id": "e7f1f4e5-7052-4ca2-9355-241ceb836f43", + "data": { + "table_id": "md_xzru7dcqrecc60", + "table_name": "Film", + "view_id": "vw_3fq2e9q8drkblw", + "view_name": "Sheet-1", + "records": [ + [ + { + "FilmId": 1022, + "Title": "x", + "Language": { + "LanguageId": 1, + "Name": "English" + }, + }, + { + "FilmId": 1023, + "Title": "x", + "Language": { + "LanguageId": 1, + "Name": "English" + }, + } + ] + ] + } +} +``` + + + + +[//]: # "## Call Log" + +[//]: # + +[//]: # "Call Log allows user to check the call history of the hook. By default, it has been disabled. However, it can be configured by using environment variable `NC_AUTOMATION_LOG_LEVEL`." + +[//]: # + +[//]: # "- `NC_AUTOMATION_LOG_LEVEL=OFF`: No logs will be displayed and no history will be inserted to meta database." + +[//]: # "- `NC_AUTOMATION_LOG_LEVEL=ERROR`: only error logs will be displayed and history of error logs will be inserted to meta database." + +[//]: # "- `NC_AUTOMATION_LOG_LEVEL=ALL`: Both error and success logs will be displayed and history of both types of logs will be inserted to meta database. **This option is only available for Enterprise Edition.**" + +[//]: # + +[//]: # "![image](https://user-images.githubusercontent.com/35857179/228790148-1e3f21c7-9385-413a-843f-b93073ca6bea.png)" + +## Variables d'environnement + +Dans la version auto-hébergée, vous pouvez configurer les variables d'environnement suivantes pour personnaliser le comportement du webhook. + +* NC\_ALLOW\_LOCAL\_HOOKS : permet d'activer les webhooks dont l'URL cible est hébergée localement. Par défaut : faux + +En savoir plus sur les variables d'environnement[ici](/getting-started/self-hosted/environment-variables)