POST

Ticket.AutomationSave

Create or update a ticket_automation row (dashboard Settings → Ticket automation). Omit id to create; send id to update. Requires manager permission. This is NOT AutomationEvents.* — it uses the ticket_automation table only.

Permissions

  • User must be logged in with a valid bearer token.
  • Returned or changed records are limited by the user permissions, team access, folder access, and account settings.

Action

  • Runs the Ticket.AutomationSave function and returns JSON.

Push Service

No push is sent because this function only reads data or returns helper information.

Automation

No automation is run for this function.

Special Instructions

  • Requires manager permission (owner or member admin).
  • condition_type: not_assigned (default) or in_status. When in_status, send condition_statuses.
  • Actions are independent flags: action_send_email, action_create_mission, action_row_color.
  • Send email (dashboard parity): email_to_customer → selected Email template to the ticket customer email; email_to_team → staff notify all Ticket team members + current assignees; email_user_ids (Member) → staff notify only checked users. Team/member use staff notify path — not the customer template.
  • email_template_id = email_template.id for customer mail only. 0 or omit on create = default (support template / prior behavior). Alias: customer_email_template_id. Do not pass bare template_id (that is mission_template_id). Picker list: Ticket.Automation / Get email_templates[] or EmailTemplates.List.
  • On update, omit email_template_id to leave the saved template unchanged.
  • Mission fields (mission_*) are used when action_create_mission=1; or send mission_config JSON.
  • Aliases Ticket.AutomationAdd / Edit / Update call the same handler.

Required Parameters

No body parameters are required for this function.

Optional Parameters

NameTypeSampleWhat it gives
id
post
int3Rule id for update. Omit to create. Aliases: data_id, rule_id, automation_id.
title
post
stringFollow up unassignedRule / event title (dashboard Name).
after_minutes
post
int15Wait minutes after ticket open before matching (min 1, default 15).
condition_type
post
stringnot_assignedMain event condition: not_assigned or in_status.
condition_statuses
post
array|string1,3Status ids when condition_type=in_status. Alias: condition_statuses[].
action_send_email
post
int1Enable send-email sub-action (0/1).
email_to_team
post
int1Email ticket team / staff notify (0/1). Not the customer template.
email_to_customer
post
int0Email customer (0/1). Uses email_template_id when set.
email_user_ids
post
array|string47,48Specific member ids to email (staff notify). Alias: email_user_ids[].
email_template_id
post
int0email_template.id for customer mail when email_to_customer=1. 0 = default (support template / prior behavior). Must belong to this org; invalid ids become 0. Alias: customer_email_template_id. Do not use bare template_id (reserved for mission).
customer_email_template_id
post
int0Alias of email_template_id.
action_create_mission
post
int0Enable create-mission sub-action (0/1).
mission_config
post
jsonOptional full mission_config JSON. Or send mission_* fields below.
mission_text
post
stringFollow up ticketMission text.
mission_assign
post
stringticket_teamticket_team | customer_manager | specific.
mission_member_ids
post
array|string47Member ids when mission_assign=specific.
mission_create_only_if_no_open
post
int1Create mission only if customer has no open mission (0/1).
mission_template_id
post
int0Template mission id. Alias: template_id.
missions_steps_id
post
int0Mission step id. Alias: mission_steps_id.
mission_project_id
post
int0Project id. Alias: project_id.
mission_project_column
post
stringProject column key. Alias: project_column.
mission_priority_color
post
stringtransparentMission priority color.
mission_delay_type
post
stringdaysminutes | hours | days.
mission_delay
post
int0Delay amount. Alias: delay.
action_row_color
post
int0Enable list row-color action (0/1).
row_color
post
string#ffe8ccRow color hex when action_row_color=1.
is_active
post
int1Active flag (0/1). Default 1 on create.

Authentication

Send the bearer token returned by Login in the request header.

Authorization: Bearer YOUR TOKEN

Sample Request

{
    "url": "\/app\/Ticket.AutomationSave",
    "method": "POST",
    "headers": {
        "Authorization": "Bearer YOUR TOKEN"
    },
    "body": {
        "title": "Follow up unassigned",
        "after_minutes": "15",
        "condition_type": "not_assigned",
        "action_send_email": "1",
        "email_to_team": "1",
        "email_to_customer": "1",
        "email_template_id": "42",
        "is_active": "1"
    },
    "url_user": "https:\/\/{user}.bull36.com\/app\/Ticket.AutomationSave",
    "url_domain": "https:\/\/{domain}\/app\/Ticket.AutomationSave"
}

Endpoint

POST /app/Ticket.AutomationSave
POST https://{user}.bull36.com/app/Ticket.AutomationSave
POST https://{domain}/app/Ticket.AutomationSave

Sample Output

{
    "success": 1,
    "message": "Success",
    "id": 3,
    "data": {
        "id": 3,
        "title": "Follow up unassigned",
        "after_minutes": 15,
        "condition_type": "not_assigned",
        "action_send_email": 1,
        "email_to_customer": 1,
        "email_template_id": 42,
        "is_active": 1
    }
}

JavaScript Example

const token = 'YOUR TOKEN';
const body = new URLSearchParams({
  title: 'Follow up unassigned',
  after_minutes: '15',
  condition_type: 'not_assigned',
  action_send_email: '1',
  email_to_team: '1',
  email_to_customer: '1',
  email_template_id: '42'
});
const res = await fetch('/app/Ticket.AutomationSave', { method: 'POST', headers: { Authorization: 'Bearer ' + token }, body });
console.log(await res.json());

Error Example

{
    "success": 0,
    "message": "Permission denied to manage ticket automation"
}