import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
});
async function main() {
const response = await client.tickets.createTicket({
chat_id: '120363000000000000@g.us',
subject: 'Customer cannot access invoices',
});
console.log(response);
}
main();curl -X POST 'https://api.periskope.app/v1/tickets/create' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"chat_id": "120363000000000000@g.us",
"subject": "Customer cannot access invoices"
}'{
"chat": {
"org_id": "00000000-0000-0000-0000-000000000000",
"chat_id": "120363000000000000@g.us",
"members": {
"key": {
"contact_id": "911111111111@c.us",
"chat_id": "120363000000000000@g.us",
"org_id": "00000000-0000-0000-0000-000000000000",
"org_phone": "911111111111@c.us",
"is_admin": false,
"is_super_admin": false,
"contact_name": "Rahul Sharma",
"contact_image": "https://example.com/files/image.png",
"contact_color": "#7D9EF1",
"is_internal": false,
"contact_labels": "vip, billing"
}
},
"is_muted": false,
"chat_name": "Example Corp Support",
"chat_type": "group",
"org_phone": "911111111111@c.us",
"chat_image": "https://example.com/files/image.png",
"created_at": "2026-01-10T08:00:00+00:00",
"chat_labels": "customer, priority",
"invite_link": null,
"group_description": null,
"custom_properties": {
"Region": "EMEA"
},
"freshdesk_metadata": {},
"zohodesk_metadata": {},
"initiated_by": null,
"is_archived": false,
"parent_community_id": null
},
"message": {
"message_id": "false_120363000000000000@g.us_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"chat_id": "120363000000000000@g.us",
"org_phone": "911111111111@c.us",
"timestamp": "2026-01-15T09:28:00+00:00",
"body": "I cannot open my invoices from the portal",
"media_path": "",
"sender_phone": "911111111111",
"sender_name": "Rahul Sharma",
"performed_by": null
},
"ticket": {
"ticket_id": "ACM-001",
"org_id": "00000000-0000-0000-0000-000000000000",
"subject": "Customer cannot access invoices",
"status": "open",
"priority": 2,
"assignee": "user@example.com",
"assigned_by": "",
"raised_by": "api",
"due_date": "2026-02-01 00:00:00+00",
"ticket_labels": "urgent, billing",
"ticket_custom_properties": {
"Workspace": "Example Corp"
},
"quoted_message_id": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"created_at": "2026-01-15T09:30:00.000Z",
"closed_at": null,
"closed_by": null,
"closed_message": null,
"first_assigned_at": null,
"is_deleted": false
},
"attached_messages": [
{
"message_id": "false_120363000000000000@g.us_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"chat_id": "120363000000000000@g.us",
"org_phone": "911111111111@c.us",
"timestamp": "2026-01-15T09:28:00+00:00",
"body": "I cannot open my invoices from the portal",
"media_path": "",
"sender_phone": "911111111111",
"sender_name": "Rahul Sharma",
"performed_by": null
}
]
}{
"code": "UNAUTHORIZED_ERROR",
"message": "Invalid bearer auth token",
"status": 401
}{
"code": "NOT_FOUND_ERROR",
"message": "quoted_message_id does not match any message in the chat",
"status": 404
}{
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"status": 422,
"fields": {
"body.chat_id": {
"message": "chat_id is required"
}
}
}{
"code": "RATE_LIMIT_ERROR",
"message": "You can only make 100 requests per second",
"status": 429
}{
"code": "UNKNOWN_ERROR",
"message": "Internal server error",
"status": 500
}Create Ticket
Creates a ticket on a chat (chat_id and subject required). Only one ticket can be raised per message. Custom property values cannot be set at creation — use the update endpoint after.
import { PeriskopeApi } from '@periskope/periskope-client';
const client = new PeriskopeApi({
authToken: 'YOUR_API_KEY',
});
async function main() {
const response = await client.tickets.createTicket({
chat_id: '120363000000000000@g.us',
subject: 'Customer cannot access invoices',
});
console.log(response);
}
main();curl -X POST 'https://api.periskope.app/v1/tickets/create' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"chat_id": "120363000000000000@g.us",
"subject": "Customer cannot access invoices"
}'{
"chat": {
"org_id": "00000000-0000-0000-0000-000000000000",
"chat_id": "120363000000000000@g.us",
"members": {
"key": {
"contact_id": "911111111111@c.us",
"chat_id": "120363000000000000@g.us",
"org_id": "00000000-0000-0000-0000-000000000000",
"org_phone": "911111111111@c.us",
"is_admin": false,
"is_super_admin": false,
"contact_name": "Rahul Sharma",
"contact_image": "https://example.com/files/image.png",
"contact_color": "#7D9EF1",
"is_internal": false,
"contact_labels": "vip, billing"
}
},
"is_muted": false,
"chat_name": "Example Corp Support",
"chat_type": "group",
"org_phone": "911111111111@c.us",
"chat_image": "https://example.com/files/image.png",
"created_at": "2026-01-10T08:00:00+00:00",
"chat_labels": "customer, priority",
"invite_link": null,
"group_description": null,
"custom_properties": {
"Region": "EMEA"
},
"freshdesk_metadata": {},
"zohodesk_metadata": {},
"initiated_by": null,
"is_archived": false,
"parent_community_id": null
},
"message": {
"message_id": "false_120363000000000000@g.us_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"chat_id": "120363000000000000@g.us",
"org_phone": "911111111111@c.us",
"timestamp": "2026-01-15T09:28:00+00:00",
"body": "I cannot open my invoices from the portal",
"media_path": "",
"sender_phone": "911111111111",
"sender_name": "Rahul Sharma",
"performed_by": null
},
"ticket": {
"ticket_id": "ACM-001",
"org_id": "00000000-0000-0000-0000-000000000000",
"subject": "Customer cannot access invoices",
"status": "open",
"priority": 2,
"assignee": "user@example.com",
"assigned_by": "",
"raised_by": "api",
"due_date": "2026-02-01 00:00:00+00",
"ticket_labels": "urgent, billing",
"ticket_custom_properties": {
"Workspace": "Example Corp"
},
"quoted_message_id": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"created_at": "2026-01-15T09:30:00.000Z",
"closed_at": null,
"closed_by": null,
"closed_message": null,
"first_assigned_at": null,
"is_deleted": false
},
"attached_messages": [
{
"message_id": "false_120363000000000000@g.us_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"chat_id": "120363000000000000@g.us",
"org_phone": "911111111111@c.us",
"timestamp": "2026-01-15T09:28:00+00:00",
"body": "I cannot open my invoices from the portal",
"media_path": "",
"sender_phone": "911111111111",
"sender_name": "Rahul Sharma",
"performed_by": null
}
]
}{
"code": "UNAUTHORIZED_ERROR",
"message": "Invalid bearer auth token",
"status": 401
}{
"code": "NOT_FOUND_ERROR",
"message": "quoted_message_id does not match any message in the chat",
"status": 404
}{
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"status": 422,
"fields": {
"body.chat_id": {
"message": "chat_id is required"
}
}
}{
"code": "RATE_LIMIT_ERROR",
"message": "You can only make 100 requests per second",
"status": 429
}{
"code": "UNKNOWN_ERROR",
"message": "Internal server error",
"status": 500
}Authorizations
Your Periskope API token, sent as Authorization: Bearer <token>. Generate one from the Periskope dashboard under Settings → API & Webhooks. API access requires an active Pro or Enterprise plan.
Body
Chat to raise the ticket on. For group chats, the chat_id ending with @g.us; for 1-1 chats, country code + number of the contact (e.g. 911111111111) or the chat_id suffixed with @c.us.
1"120363000000000000@g.us"
Subject of the new ticket
1"Customer cannot access invoices"
message_id (or unique id) of the message in the chat to raise the ticket from. The message must exist in the chat (404 otherwise), and only one ticket can be raised per message — a second create for the same message is rejected. Stored and returned as the unique id of the message.
1"false_120363000000000000@g.us_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
Email of the member to assign the ticket to. Must be the email of a member of the organization — the request is rejected otherwise.
"user@example.com"
Due date of the new ticket. Accepts ISO 8601 (e.g. 2026-02-01T00:00:00Z) and any format parseable as a JavaScript date (YYYY-MM-DD, MM/DD/YYYY, etc.). Epoch timestamps are not supported.
"2026-02-01"
Priority of the ticket as a string: '1' (low), '2' (medium), '3' (high) or '4' (urgent). An empty string is ignored (the priority is left unchanged/unset). New tickets have no priority unless one is provided.
"2"
Initial status of the ticket: 'open', 'inprogress', 'closed' or 'archived'. Defaults to 'open'.
open, inprogress, closed, archived "open"
Comma-separated list of ticket label names to apply, matched case-insensitively. Labels that do not exist yet are created automatically. An empty string is ignored.
"urgent, billing"
Response
The created ticket with its chat and quoted message
A ticket together with its chat, the message it was raised from and (on GET /tickets/{ticket_id}) the messages attached to it.
The chat the ticket is raised on. null in the rare case the chat record is no longer available.
Show child attributes
Show child attributes
The message the ticket was raised from (quoted_message_id). Always present as an object — every field in it is null when the ticket is not linked to a message.
Show child attributes
Show child attributes
The ticket itself
Show child attributes
Show child attributes
Messages attached to the ticket. Populated only by GET /tickets/{ticket_id} — always an empty array in create and update responses.
Show child attributes
Show child attributes
Was this page helpful?