Offers
Offer methods live under SL.client.offers. They all return promises and work with the Offer object.
The expected flow is a single, short-lived pass: generate (or fetch) → display → claim. Keep the time between generating and claiming as short as possible.
Never cache or store offers. If an offer is no longer recommendable when your claim call arrives, it is discarded — see Errors & Warnings.
generate()
Generates fresh offers for the current reader. Takes no arguments.
Returns an array of Offer objects.
const offers = await SL.client.offers.generate();fetch({ uuid })
Fetches a single offer by its uuid.
uuid(required) — the offer's uuid.
Returns a single Offer object, including the recommendable field.
Use fetch to spotlight a specific offer — for example, one that is contextual to the content surrounding it. It is not meant as an extra step between generate and claim: offers you just generated can be claimed directly.
Always check recommendable before displaying a fetched offer. When it's false, don't show it — claims to it will be discarded.
const offer = await SL.client.offers.fetch({ uuid: "offer_recommendation_9f8e7d6c5b4a" });
if (offer.recommendable) {
// render the offer in your UI
}claim({ email, uuid })
Claims an offer for the reader.
uuid(required) — the offer's uuid.email— the reader's email address. Required forleadoffers, not required forclickoractionoffers.
The return value depends on the offer's conversion_type:
leadoffers return{ response: "ok" }.clickandactionoffers return{ redirect_url }.
Readers must explicitly choose the offers you claim for them. Misleading readers into claiming offers without their consent results in a permanent block of your SparkLoop account.