Create
Triggered when a new ticket is created
Event Type
"ticket.create"Description
This event is triggered whenever a new ticket is created in your server, whether through a ticket panel button, slash command, or any other method.
Payload Structure
Prop
Type
Example Payload
{
"type": "ticket.create",
"payload": {
"ticketId": "TKT-1234",
"panelId": "support-panel",
"channel": {
"id": "1140972530400776294",
"name": "ticket-0001"
},
"creatorId": "713115896805064856",
"openDate": "2024-01-18T15:30:00.000Z",
"questions": [
{
"question": "What is your issue?",
"answer": "I need help with billing"
},
{
"question": "Have you tried troubleshooting?",
"answer": "Yes, but it didn't work"
}
]
}
}Example Usage
app.post('/webhook', (req, res) => {
const { type, payload } = req.body;
if (type === 'ticket.create') {
console.log(`New ticket created!`);
console.log(`Ticket ID: ${payload.ticketId}`);
console.log(`Creator: ${payload.creatorId}`);
console.log(`Channel: ${payload.channel.name}`);
// If form questions were answered
if (payload.questions) {
console.log('Form responses:');
payload.questions.forEach(q => {
console.log(` ${q.question}: ${q.answer}`);
});
}
// Send notification to your system
await notifyNewTicket(payload);
}
res.status(200).send('OK');
});Use Cases
- Send notifications to external systems when tickets are created
- Log ticket creation for analytics
- Automatically assign tickets based on form responses
- Create corresponding tickets in your own helpdesk system
- Track ticket creation metrics