Skip to main content
JavaScript
Smile.activities.create({
  token: 'activity_1dDdzcKNsp84b'
}).then((activity) => {
  // Handle the activity object
});
This async method creates an activity in Smile for an action that the currently logged-in customer has performed. Smile will asynchronously issue a reward for the activity based on the ways to earn configured in the Smile account. Before creating an activity, a custom activity type must be first defined in the Smile Admin.
Using this method in your frontend code exposes the activity token, which can be used by tech-savvy customers to call this method manually from their browser’s console (even if they haven’t completed the desired action).We recommend only using this method to create activities that correspond to ways to earn which are rate limited (e.g. will only be rewarded for once) or have a low reward value. Alternatively, you can use the backend create an activity endpoint instead.

Parameters

activityAttributes
object
required

Returns

This method returns a Promise that: If the method is improperly invoked (e.g. missing required parameters) or no customer is currently logged in, the Promise will be rejected.