Share Action

The ability to share the product or discount from the app

Description

The Share action opens the device’s native Share Sheet (Android / iOS), allowing users to share content from your app to other apps such as WhatsApp, Instagram, Messages, Email, and more.

This is commonly used for:

  • Sharing product links
  • Sharing referral codes
  • Sharing order/track links
  • Sharing promotional banners or campaigns

Function Signature

VajroSDK.actions.share({
        text: string
      });
ParameterTypeRequiredDescription
textStringYesThe string can be product link, collection link, any text that needs to be shared.

Structure of Response

StatusResponse
Success{ "status": "success", "message": "Checkout opened with the the provided line items" }
Invalid Params{ "status": "error", "errorId": 400, "errorHandle": "invalid-params", "message": "Invalid params" }
Unexpected Error{ "status": "error", "errorId": 500, "errorHandle": "unknown-error", "message": "Something unexpected happened" }

Example Usage

const product_handle = VajroSDK.variables.product.handle;
const prod_url = "https://" + VajroSDK.variables.store.domain + "/products/" + product_handle;
function shareUrl() {
  VajroSDK.actions.share({ text: prod_url });
}
<button onclick="shareUrl()">Share</button>

Best Practices

  1. Keep text short and friendly — most apps truncate long messages.
  2. Prefer sharing URLs that open correctly outside the app.
  3. Include UTM parameters (if your tracking supports it) to measure share performance.

Caveats

  1. If url is not publicly reachable, recipients may not be able to open it.
  2. Passing large images or non-HTTPS URLs may fail on some devices/apps.
  3. The action does not guarantee the user completed sharing (no success/failure callback).
  4. Provide at least one of text, url, or imageUrl — empty payloads may do nothing.