Start
Triggered when a giveaway is created
Event Type
"giveaway.start"Description
This event is triggered whenever a giveaway is created, whether it was started from the bot, from the dashboard, or by an automation.
Payload Structure
Prop
Type
duration.value means a different thing per type: milliseconds for DURATION, a participant goal for PARTICIPANTS, and a server member goal for MEMBERS. Only a DURATION giveaway has a known end time, so endsAt is left out of the other two.
Example Payload
{
"type": "giveaway.start",
"payload": {
"giveawayId": "hT7pLm2Qa9",
"prize": "Nitro Classic",
"description": "",
"channelId": "1140972530400776294",
"messageId": "1141002938471829504",
"messageUrl": "https://discord.com/channels/1140972530400776290/1140972530400776294/1141002938471829504",
"winnersCount": 3,
"creatorId": "280158289667555328",
"hostedBy": "280158289667555328",
"createdAt": "2024-01-18T15:30:00.000Z",
"duration": {
"type": "DURATION",
"value": 86400000,
"endsAt": "2024-01-19T15:30:00.000Z"
},
"requiredRoles": ["1140972530400776291"],
"requiredRolesMode": "OR",
"blockedRoles": [],
"bypassRoles": [],
"winnerRoles": []
}
}Example Usage
app.post('/webhook', (req, res) => {
const { type, payload } = req.body;
if (type === 'giveaway.start') {
console.log(`Giveaway started: ${payload.prize}`);
console.log(`Winners: ${payload.winnersCount}`);
// Mirror the giveaway on your own site
await createGiveaway({
id: payload.giveawayId,
prize: payload.prize,
url: payload.messageUrl,
endsAt: payload.duration.endsAt,
});
}
res.status(200).send('OK');
});Use Cases
- Announce new giveaways on your website, forum, or another platform
- Keep an external record of every giveaway a server has run
- Schedule your own reminder before a time based giveaway ends
- Audit who is starting giveaways and with what requirements