Difference between revisions of "Module Webhook"
m Tag: 2017 source edit |
m (→Execution) Tag: 2017 source edit |
||
(26 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
Links below are automatically managed by PolyglotBot | Links below are automatically managed by PolyglotBot | ||
You can edit links on the English source page : Module_Webhook --> | You can edit links on the English source page : Module_Webhook --> | ||
− | [[fr: | + | [[fr:Module_Webhook_FR]] |
<!-- END interlang links --> | <!-- END interlang links --> | ||
{{TemplateDocUser}} | {{TemplateDocUser}} | ||
Line 9: | Line 9: | ||
= Introduction = | = Introduction = | ||
− | The module WebHook add the possibility to send a JSON message to an URL | + | The module WebHook add the possibility to send a JSON message to an external URL, on a triggered Dolibarr event. |
= Installation = | = Installation = | ||
Line 17: | Line 17: | ||
{{ActivationModuleEn}} | {{ActivationModuleEn}} | ||
− | = Add a target = | + | == Add a target == |
− | The only configuration needed for this module is adding a target. This is done by going into the module configuration, then click on the menu target. Then just click on the plus sign on the top right of the page, fill one or multiple trigger event and to add an URL to the site we want to post the JSON. | + | The only configuration needed for this module is adding a target. This is done by going into the module configuration, then click on the menu target. Then just click on the plus sign on the top right of the page, fill one or multiple trigger event and to add an URL to the site we want to post the JSON. You can find information on Trigger event on the wiki page [[Triggers|Triggers]]. |
− | = JSON | + | '''Exemple:''' |
+ | |||
+ | [[Image:Image of Webhook configuration.png]] | ||
+ | |||
+ | = Execution = | ||
+ | |||
+ | So once setup is done, each time a business event occurs in Dolibarr for the triggers defined into the setup, a call will be done to the targeted URL. The message will be a JSON message like this example: | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
{ | { | ||
"triggercode" : "TRIGGER_CODE", | "triggercode" : "TRIGGER_CODE", | ||
− | "object" : " | + | "object" : {DolibarrObject} |
+ | } | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | '''Exemple of message sent by Dolibarr when the event COMPANY_CREATE is executed:''' | ||
+ | |||
+ | <syntaxhighlight lang="json"> | ||
+ | { | ||
+ | { | ||
+ | "triggercode":"COMPANY_CREATE", | ||
+ | "object": | ||
+ | { | ||
+ | "id":39,"entity":1,"element":"societe","fk_element":"fk_soc","table_element":"societe","table_element_line":"","ismultientitymanaged":1, | ||
+ | "import_key":"","array_options":{"options_height":"","options_weight":"","options_prof":"","options_birthdate":false}, | ||
+ | "restrictiononfksoc":1,"context":[],"canvas":"","ref_ext":"","status":"1","country_id":"117","state_id":"0", | ||
+ | "multicurrency_code":"EUR","note_public":"","note_private":"","comments":[],"name":"Test Webhook",... | ||
+ | } | ||
+ | } | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | ... |
Latest revision as of 07:12, 30 August 2023
Introduction
The module WebHook add the possibility to send a JSON message to an external URL, on a triggered Dolibarr event.
Installation
This module is included with the Dolibarr distribution, so there is no need to install it.
Configuration
To use this module, you must first enable it using an administrator account, via the menu option "Home - Setup - Modules".
Choose the tab where the module is listed. Then click on "Activate".
The module is now activated.
If a cog icon appears on module thumb or at end of the line of the module, click on it to access the setup page specific to the module.
Add a target
The only configuration needed for this module is adding a target. This is done by going into the module configuration, then click on the menu target. Then just click on the plus sign on the top right of the page, fill one or multiple trigger event and to add an URL to the site we want to post the JSON. You can find information on Trigger event on the wiki page Triggers.
Exemple:
Execution
So once setup is done, each time a business event occurs in Dolibarr for the triggers defined into the setup, a call will be done to the targeted URL. The message will be a JSON message like this example:
{
"triggercode" : "TRIGGER_CODE",
"object" : {DolibarrObject}
}
Exemple of message sent by Dolibarr when the event COMPANY_CREATE is executed:
{
{
"triggercode":"COMPANY_CREATE",
"object":
{
"id":39,"entity":1,"element":"societe","fk_element":"fk_soc","table_element":"societe","table_element_line":"","ismultientitymanaged":1,
"import_key":"","array_options":{"options_height":"","options_weight":"","options_prof":"","options_birthdate":false},
"restrictiononfksoc":1,"context":[],"canvas":"","ref_ext":"","status":"1","country_id":"117","state_id":"0",
"multicurrency_code":"EUR","note_public":"","note_private":"","comments":[],"name":"Test Webhook",...
}
}
}
...