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"
}
});| Parameter | Type | Required | Description |
|---|---|---|---|
| attributes | Object | Yes | JSON object of marketing attributes to save. Values may be strings, objects, or arrays. |
Structure of Response
| Status | Response |
|---|---|
| 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
- Always pass
attributesas a JSON object, not an array. - Read the current profile with
getProfilefirst if you need to merge with existing keys. - Handle errors with
try/catchand show a toast for user-facing failures.
Caveats
attributesis required. The helper will reject a missing or non-object payload.- This helper updates marketing profile data; it does not update Shopify customer fields.
Updated about 7 hours ago
Did this page help you?