- Fourthwall mints the gifts. They’re created on the purchase and arrive on the
GIFT_PURCHASEwebhook, each with its own gift id (gft_…). Your app never creates a giveaway. - Your app runs the draw. It collects entries from the stream, picks the winner(s), and hands each winner the redemption link for their gift. There’s no “finish” call — the gift link is the handoff back to Fourthwall.
How It Works
- A supporter buys a gift offer on the storefront while the creator is live. (Gift offers are only purchasable while the shop is live.)
- Fourthwall mints the gifts and delivers a
GIFT_PURCHASEwebhook. The payload carries the minted gifts asgifts[], each with agft_…id. - Your app opens a short entry window (e.g. the creator’s configured entry-time limit).
- Viewers opt in — typically by typing
!enterin chat. Your app collects theiruserId/userName. - When the window closes, your app picks up to one winner per gift at random.
- Your app sends each winner a link to their gift’s redemption page (keep the links private — only hand each one to the winner you picked).
- The winner opens the link and claims the prize on the storefront.
1. Configure the gifting rules
A shop’s gifting rules — whether gifting is enabled, the entry-time limit, the shipping policy, and which products are giftable — live on its gifting config: Get gifting config and Update gifting config (GET/PUT /open-api/v1.0/gifting/config). Most integrations surface these as settings in the app so the creator controls them; the write operates on the app’s OPEN_API gifting slot.
2. Subscribe to the webhook
Create a webhook forGIFT_PURCHASE — this is the trigger that opens a draw. (Add PLATFORM_APP_DISCONNECTED too if you want to know when the creator uninstalls.)
3. Handle the gift purchase
WhenGIFT_PURCHASE arrives, read the gifts off the payload and open an entry window. Each entry in gifts[] is one prize, with a gft_… id you’ll redeem later:
4. Collect participants from your stream
This part lives in your app, not in the Fourthwall API. A typical flow:- Subscribe to Twitch EventSub
channel.chat.message(or Discord, or a web form). - Watch for an
!entercommand from viewers while the window is open. - Store
{ userId, userName }for each entrant in a deduped set. - Close the window when the entry timer expires.
5. Send each winner their redemption link
Pick the winner(s) yourself — one per gift — and send each the redemption page for their gift. The link is the shop’s storefront URL plus the gift id:OAuth scopes
If your integration uses OAuth instead of API keys, requestgiveaway_write + webhook_write + offer_read. See App OAuth for the full app authorization flow.
Reference
streaming-gifting example
A complete runnable Platform App for this flow
Get Gift Purchase
GET /gift-purchase/{id} — the gifts[] payloadGifting config
GET/PUT /gifting/config — the gifting rulesManaging Webhooks
Subscribe to
GIFT_PURCHASE + verify signaturesApp OAuth
Request
giveaway_write for gifting