Docs »

API »

Endpoints »

Tickets

Compose

POST /rest/tickets/compose.json

Create a ticket object.

Parameters

Req’d Field Type Notes
  bcc string  
  bucket_id integer  
  cc string  
x content string  
  content_format string markdown for HTML or blank for plaintext
  custom_* mixed  
  dont_send integer 0=create/send normally, 1=create ticket without sending
  file_id[] ids Upload with attachments
x group_id integer  
  html_template_id id html template
  org_id id organization
  owner_id id worker
  reopen_at mixed unix timestamp or string (e.g. “Friday 2pm”, “+2 hours”)
  send_at mixed When the message should be delivered. Defaults to now. Unix timestamp or string (e.g. “Friday 2pm”, “+2 hours”)
  status integer 0=open, 1=waiting, 2=closed, 3=deleted
x subject string  
x to string  

Example


$postfields = [
    array('expand','bucket_,group_,custom_'),
    array('group_id','6'),
    array('bucket_id','6'),
    array('org_id','123'), // optional
    array('to','customer@example.com'),
    array('cc','cc@example.com'), // optional
    array('bcc','bcc@example.com'), // optional
    array('subject','Testing compose from API'),
    array('content','This is the raw message with an attachment'),
    array('status','1'), // 0=open, 1=waiting, 2=closed, 3=deleted
    array('reopen_at', strtotime('+1 day')),
    array('file_id[]', '368'), // optional, can send multiple instances
    array('html_template_id', '1'), // optional
    array('custom_5','+1 hour'), // date custom field
    array('custom_6',"Line 1\nLine 2\nLine 3"), // multi-line
    array('custom_4','Option 3'), // picklist
];
$out = $cerb->post($base_url . 'tickets/compose.json', $postfields);

Reply

POST /rest/tickets/reply.json

Reply to a ticket message as a worker.

Parameters

Req’d Field Type Notes
  bcc string A comma-separated list of email addresses that will privately receive a copy of this message.
  bucket_id id Move the ticket to a new bucket
  cc string A comma-separated list of email addresses that will publicly receive a copy of this message.
x content string The content of the reply message
  content_format string markdown for HTML or blank for plaintext
  custom_* mixed  
  dont_keep_copy boolean Send the reply by email without saving a copy in Cerb: 0=no, 1=yes
  dont_send boolean Save the reply in Cerb without sending email: 0=no, 1=yes
  file_id[] ids Upload with attachments
  group_id id Move the ticket to a new group
  html_template_id id mail template
  is_autoreply boolean Automatically include auto-reply mail headers: 0=no, 1=yes
  is_broadcast boolean Set the broadcast flag: 0=no, 1=yes
  is_forward boolean Send the message without updating the ticket with the new subject or requesters: 0=no, 1=yes
x message_id id The ticket message being replied to
  owner_id id Assign the ticket to a worker, or 0 to unassign from the current owner
  reopen_at mixed unix timestamp or string (e.g. “Friday 2pm”, “+2 hours”)
  send_at mixed When the message should be delivered. Defaults to now. Unix timestamp or string (e.g. “Friday 2pm”, “+2 hours”)
  status integer 0=open, 1=waiting, 2=closed, 3=deleted
  subject string Update the ticket’s subject
  to string A comma-separated list of email addresses to include as recipients. If blank, it uses the ticket’s current requesters
  worker_id id The specific worker to send the message as. This defaults to the current API user, and can only be changed by administrators

Example


$postfields = [
    array('expand','bucket_,group_,custom_'),
    array('message_id','1024'),
    array('content','This is the raw message with an attachment'),
    array('bcc','bcc@example.com'), // optional
    array('bucket_id','6'), // group_id is unnecessary because this is non-zero
    array('cc','cc@example.com'), // optional
    array('custom_4','Option 3'), // picklist custom field
    array('custom_5','+1 hour'), // date custom field
    array('custom_6',"Line 1\nLine 2\nLine 3"), // multi-line custom field
    array('file_id[]', '368'), // optional, can send multiple instances
    array('reopen_at', strtotime('+1 day')),
    array('status','1'), // 0=open, 1=waiting, 2=closed, 3=deleted
    array('subject','Testing compose from API'), // optional
    array('to','customer@example.com'), // optional
    array('html_template_id', '1'), // optional
];
$out = $cerb->post($base_url . 'tickets/reply.json', $postfields);