# Join (/api/events/giveaways/join)



## Event Type [#event-type]

```ts
"giveaway.join"
```

## Description [#description]

This event is triggered when a member successfully enters a giveaway, through the join button, the captcha, or the giveaway page. A member who is refused, or who has already entered, produces no event.

<Callout type="warn">
  On a busy giveaway this is the noisiest giveaway event, one request per entry. Free servers get 150 requests per day across all events, so leave the Giveaways category off if entries are not what you are after.
</Callout>

## Payload Structure [#payload-structure]

<TypeTable
  type="{
  giveawayId: {
    description: 'Unique identifier for the giveaway',
    type: 'string',
  },
  prize: {
    description: 'The prize as it is written on the giveaway message',
    type: 'string',
  },
  channelId: {
    description: 'Discord channel the giveaway was posted in',
    type: 'string',
  },
  messageId: {
    description: 'Discord message ID of the giveaway message',
    type: 'string',
  },
  messageUrl: {
    description: 'Direct link to the giveaway message',
    type: 'string',
  },
  userId: {
    description: 'Discord user ID of the member who entered',
    type: 'string',
  },
  username: {
    description: 'Username of the member who entered',
    type: 'string',
  },
  entries: {
    description: 'How many entries this member holds in the draw, more than one with boosted roles',
    type: 'number',
  },
  participantsCount: {
    description: 'Total number of members entered after this join',
    type: 'number',
  },
}"
/>

## Example Payload [#example-payload]

```json
{
  "type": "giveaway.join",
  "payload": {
    "giveawayId": "hT7pLm2Qa9",
    "prize": "Nitro Classic",
    "channelId": "1140972530400776294",
    "messageId": "1141002938471829504",
    "messageUrl": "https://discord.com/channels/1140972530400776290/1140972530400776294/1141002938471829504",
    "userId": "713115896805064856",
    "username": "johndoe",
    "entries": 3,
    "participantsCount": 42
  }
}
```

## Example Usage [#example-usage]

```ts
app.post('/webhook', (req, res) => {
  const { type, payload } = req.body;

  if (type === 'giveaway.join') {
    console.log(`${payload.username} entered ${payload.prize}`);
    console.log(`Entries: ${payload.entries}`);

    // Show a live entry counter on your site
    await updateEntryCount(payload.giveawayId, payload.participantsCount);
  }

  res.status(200).send('OK');
});
```

## Use Cases [#use-cases]

* Show a live entry count outside Discord
* Track which members take part in giveaways
* Watch how boosted roles change the odds in a running giveaway
