Update Profile

Updates the marketing profile with the given attributes JSON.

Description

The updateProfile helper writes marketing attributes to the current profile in the app.
Pass a JSON object in attributes. Values may be strings, objects, or arrays.

Function Signature

await Superfans.helpers.marketing.updateProfile({
  attributes: {
    key: "value"
  }
});
ParameterTypeRequiredDescription
attributesObjectYesJSON object of marketing attributes to save. Values may be strings, objects, or arrays.

Structure of Response

StatusResponse
Success{ "status": "success", "message": "Profile updated successfully" }
Invalid Params{ "status": "error", "errorId": 400, "errorHandle": "invalid-params", "message": "Update profile attributes should be provided." }
Unexpected Error{ "status": "error", "errorId": 500, "errorHandle": "unknown-error", "message": "Something unexpected happened" }

Example Usage

try {
  await Superfans.helpers.marketing.updateProfile({
    attributes: {
      key: "value"
    }
  });
} catch (error) {
  await Superfans.actions.showToast({
    title: "Something went wrong",
    message: "Please try again."
  });
}

Best Practices

  1. Always pass attributes as a JSON object, not an array.
  2. Read the current profile with getProfile first if you need to merge with existing keys.
  3. Handle errors with try/catch and show a toast for user-facing failures.

Caveats

  1. attributes is required. The helper will reject a missing or non-object payload.
  2. This helper updates marketing profile data; it does not update Shopify customer fields.

Did this page help you?