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
});| Parameter | Type | Required | Description |
|---|---|---|---|
| text | String | Yes | The string can be product link, collection link, any text that needs to be shared. |
Structure of Response
| Status | Response |
|---|---|
| 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
- Keep text short and friendly — most apps truncate long messages.
- Prefer sharing URLs that open correctly outside the app.
- Include UTM parameters (if your tracking supports it) to measure share performance.
Caveats
- If url is not publicly reachable, recipients may not be able to open it.
- Passing large images or non-HTTPS URLs may fail on some devices/apps.
- The action does not guarantee the user completed sharing (no success/failure callback).
- Provide at least one of text, url, or imageUrl — empty payloads may do nothing.
Updated about 1 month ago