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
Upload answers
Images uploaded to an Image Upload form question are stored privately and have no permanent
link. Those questions carry an upload object which you exchange for the image using your HTTP
events token. See Uploads for the endpoint.
answer is set to the same URL as upload.url, so a consumer that only reads answer still
gets something it can fetch.
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",
"required": true,
"upload": null
},
{
"question": "Upload a screenshot",
"answer": "https://tickety.top/api/uploads/tickets/TKT-1234/a1b2c3d4.webp",
"required": false,
"upload": {
"scope": "tickets",
"id": "TKT-1234",
"filename": "a1b2c3d4.webp",
"url": "https://tickety.top/api/uploads/tickets/TKT-1234/a1b2c3d4.webp"
}
}
]
}
}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