Skip to main content
The Send Triggered Gifts pattern creates gifts programmatically for a list of recipients — triggered by events like hiring, anniversaries, or milestone completions. Gifts are created in the V2 gifting API and sent to recipients who choose their own product from a curated selection.

Prerequisites

  • API key with gifts:create scope
  • At least one Campaign configured in the Snappy Dashboard
  • The campaignId for the campaign you’re sending under

Create gifts

Pass a recipients array — each entry creates one gift for one recipient.
The V2 gifting API uses lowercase field names for recipient names: firstname and lastname (not camelCase). This differs from the V3 orders API which uses firstName / lastName.
JavaScript
Python

Chunking for large lists

The V2 gifts endpoint has a maximum recipients per request. For large sends, split into chunks of 100 and send sequentially (or with bounded concurrency):
JavaScript
Python

Idempotency

Each recipient entry accepts a key field — a stable, permanent identifier for that recipient in the context of this send. Snappy uses this to deduplicate: sending the same key twice does not create a second gift. Derive key from stable identifiers, not from random values or timestamps:
JavaScript
Keys must be unique within a campaign. A good pattern: {campaignId}-{userId} or {campaignId}-{employeeId}.

Partial failure handling

The API may succeed for some recipients and fail for others in the same request. The response includes per-recipient status: Always inspect errors in the response and re-run the failed recipients rather than the full list. Since each recipient has a key, re-running is safe — duplicates are silently ignored.
JavaScript
Last modified on July 27, 2026