A WebHook is a callback request (HTTP POST) made to a specific URL when something happens.
In our case, we have these configurable Webhooks available:
New tag image
Delete tag image
New einstein prediction
These callbacks can be configured on the admin page, in the Webhooks section. You can provide your URL on which you want the WebHook (callback) to occur.
To know more on those events and how they are triggered, refer to the following article: Types of SharinPix Events
1. In order to use Webhooks, you should ensure that you have granted API access to SharinPix on your organization. To verify this, go to the SharinPix Settings tab and check if the second row, that is, Sharinpix -> Salesforce full API access, is highlighted in green.
In case the row, Sharinpix -> Salesforce full API access is still highlighted in red, simply click on the Grant button to grant API access.
For more detailed information on how to grant API access, please refer the the following article:
2. All Webhooks of type apex_method make use of Salesforce API and should be used only when needed.
Select the ‘Webhooks’ menu item from the navigation bar.
Click on the ‘New Webhook’ button.
Enter the relevant details for the Webhook.
In this case, we will use another type of webhook which will execute a static method on your Salesforce environment. The sample code below illustrates an example method which is called by a webhook.
- payload is the json string containing the relevant actions.
- webhookInformation contains information about the webhook such as the event type.
Next, go to the SharinPix Administration dashboard, click on the menu Webhooks and New Webhook. Select Action type apex_method and insert your class name and method name and select New einstein prediction as event type.