Changes

m
Line 9: Line 9:     
= Introduction =
 
= Introduction =
The module WebHook add the possibility to send a JSON message to an URL after the trigger of a Dolibarr event.
+
The module WebHook add the possibility to send a JSON message to an external URL, on a triggered Dolibarr event.
    
= Installation =
 
= Installation =
Line 18: Line 18:     
== 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]].
 +
 
 +
'''Exemple:'''
 +
 
 +
[[Image:Image of Webhook configuration.png]]
    
= Execution =
 
= 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 JSON message like this example:
+
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" : "Dolibarr object"
+
   "object" : {DolibarrObject}
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
   −
'''Exemple:'''
+
'''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>
 
...
 
...