Image Sync for pictures uploaded via SharinPix Mobile App

circle-exclamation

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.

circle-info

Learn more about SharinPix Image Sync in this article: What is SharinPix Image Sync?

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

circle-exclamation

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.

circle-exclamation
circle-info

For more information about SharinPix Events, head over to the following chapter: SharinPix integration - 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:

circle-info

Information:

  • If you intend to perform an Image Sync for each and every image during an upload, select the checkbox New Image

  • To perform an Image Sync for each and every image being tagged, then choose New tag image

  • To perform an Image Sync for each and every image deleted, select Delete image

  • To perform Image Sync when a tag is removed, use Delete tag image

  • If you intend to perform an Image Sync once and only after all images have been uploaded, then select the checkbox labeled Upload done

circle-check
triangle-exclamation

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

Last updated

Was this helpful?