Image Sync for pictures uploaded via SharinPix Mobile App
Overview
Objective
In the present article, we will learn how to initiate the execution of Image Sync when uploading images using the SharinPix Mobile App. For each newly uploaded image, a corresponding SharinPix Image record will be created.

The process of syncing the uploaded images takes place in 2 major steps:
1. A SharinPix Webhook detects image upload events
2. The SharinPix Webhook executes a particular Apex method to perform an Image Sync
1. How does SharinPix Webhook work?
Step 1: SharinPix Webhook detects an upload
A SharinPix Webhook can be created and configured in such a way as to detect when an image is uploaded to SharinPix.
An upload process triggers three main types of events that can be detected by webhooks:
image_new: This event is triggered for every single image during an upload to SharinPix
upload_done: This event is triggered once all images have been uploaded to SharinPix
new_tag_image: This event is triggered when a new tag is applied to an image
In the upcoming sections, we will see how it is possible to configure a SharinPix Webhook to detect these events.
Step 2: SharinPix Webhook performs Image Sync via an Apex method
Once an upload event is detected, the next step is to initiate the Image Sync process. This can be accomplished by invoking a SharinPix Event Handler method named synchronize which is available in the SharinPix package.
How to configure the Webhook?
To configure a Webhook, follow the steps below:
From App Launcher , search and click on SharinPix Settings
On the SharinPix Settings tab, click on the button labeled as Go to administration dashboard (Enter your organization's credentials if asked)

Once on the administration dashboard, select Webhooks from the top menu bar
Click on the button New Webhook
Then, configure the SharinPix Webhook as follows:
Action Type: apex_method
Class name: sharinpix.ImageSyncMigration
Method name: synchronize
Next, select the required checkbox (example: Upload done, New image, Delete image, New tag image or Delete tag image)
Click on Update V2 when done
The following example demonstrates a SharinPix Webhook configuration to perform an Image Sync on Upload Done:

Perform an Image Sync on Upload Done
If you intend to perform an Image Sync once and only after all images have been uploaded, configure a SharinPix Webhook using the following values:
Action Type: apex_method
Class name: sharinpix.ImageSyncMigration
Method name: synchronize
Checkbox Upload done: checked

Perform an Image Sync on Image New
If you intend to perform an Image Sync for each and every image during an upload, configure a SharinPix Webhook using the following values:
Action Type: apex_method
Class name: sharinpix.ImageSyncMigration
Method name: newImage
Checkbox New Image: checked

Perform an Image Sync on New Tag
If you intend to perform an Image Sync for each and every image being tagged, configure a SharinPix Webhook using the following values:
Action Type: apex_method
Class name: sharinpix.ImageSyncMigration
Method name: tagImage
Checkbox New tag image: checked


