This methods 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.
Warning: 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 create an activity endpoint instead.
Parameters
An object containing a token attribute corresponding to the type of custom activity being created.
Returns
This method returns a Promise that:
- On success, resolves with an activity object.
- On failure, resolves with an error object.
If the method is improperly invoked (e.g. missing required parameters) or no customer is currently logged-in, the Promise will be rejected.