Logo
ХелпдескУправление знаниямиБизнесуТарифыЧто такое KCS?Блог
Русский
Личный кабинет
Работа с заявками
© 2023 - 2026 ООО «Свормика». Swarmica - Платформа управления знаниями и ресурсами техподдержки. Версия: 6.1.2

#1464: Webhook for creating a ticket from one Swarmica to another

Отредактирована: сегодня

Symptoms

There are two Swarmica instances in which different support teams work. Sometimes clients create tickets in the first instance that are intended for the team working in the second instance. It is necessary to somehow transparently transfer the ticket to the second team.

Solution

To solve the problem, you can use the function of outgoing webhooks. For example, you can make logic that when a ticket is transferred to a certain group, a webhook will be sent to the second instance and create a ticket there, duplicating the request, subject, and sender.

  1. To create such an action:
  2. Go to the SECOND INSTANCE and create an API token in the Settings > API and Integrations section.
  3. Go to the FIRST INSTANCE to Settings > Action by event and click Create + Outgoing Webhook. Fill in the name.
  4. On the left side of the screen, select the Event Type TicketEvent = Ticket Group Changed.
  5. Add the New Value field and make it equal to the required group.
  6. On the right side, click Create. Fill in the name.
  7. In the URL field, we specify the path to the endpoint: https://URL_of_the_second_instance/api/tickets/
  8. Select the POST method.
  9. Fill in the Header and Data (see example below) and Save the webhook.
  10. On the left, change the Status to Enabled and Save the action.

Header

{
  "Content-Type": "application/json",
  "Authorization": "Token your_token_from_step_1"
}

Data:

{
  "subject": "{{event.ticket.subject}}",
  "comment": {% set comment = event.ticket.comments.order_by('created_at').first() %}{% if comment %}{{ comment.body | tojson}}{% endif%},
  "requester_email": "{{event.ticket.requester.email}}"
}

Now, when a ticket is transferred in the first instance to the specified group, the webhook will create a new ticket with the same subject and the same first comment and sender in the second instance, where the second team can already work with it.