Enabling Zendesk two-way synchronization

Краткое описание

В этой документации мы рассмотрим:

  • Включение настроек синхронизации Zendesk в Discourse
  • Настройку вебхука Zendesk
  • Создание триггера Zendesk

Включение настроек синхронизации Zendesk

Для начала вам нужно включить плагин Zendesk, активировать настройку синхронизации и предоставить безопасный токен.

  1. Переход к настройкам плагина: Зайдите на ваш сайт Discourse и перейдите на страницу настроек плагина Zendesk по адресу /admin/plugins/discourse-zendesk-plugin. Альтернативно, вы можете найти настройки, выполнив поиск на странице /admin/site_settings.
  2. Включение плагина: Найдите и включите настройку zendesk enabled, если она ещё не активна.
  3. Включение настройки синхронизации: Найдите и включите настройку sync comments from zendesk.
  4. Указание токена вебхука: В поле zendesk incoming webhook token сгенерируйте и добавьте случайную безопасную строку. Этот токен будет использоваться позже при настройке вебхука Zendesk.
  5. Настройка категорий для автогенерации: Двусторонняя синхронизация работает только для тем в категориях, настроенных для автоматической генерации тикетов Zendesk. Либо включите zendesk autogenerate all categories, либо добавьте конкретные категории в настройку zendesk autogenerate categories. Без этого вебхук будет молча игнорировать входящие комментарии.

Настройка вебхука Zendesk

Следуйте этим шагам для настройки вебхука в Zendesk:

  1. Переход к странице вебхуков: Перейдите в раздел Webhooks в Zendesk в меню Apps and integrationsWebhooks.
    • Пример URL: https://<instance_name>.zendesk.com/admin/apps-integrations/webhooks/webhooks
  2. Создание вебхука:
    • Нажмите кнопку Actions в правом верхнем углу.
    • Выберите Create Webhook.
    • Заполните данные вебхука:
      • Request method: PUT
      • Endpoint URL: https://<discourse.example.com>/zendesk-plugin/sync
      • Request format: JSON


  1. Тестирование вебхука:
    • Нажмите кнопку Test Webhook.
    • В выпадающем списке выберите ‘Custom Test’.
    • Замените JSON следующим содержимым, вставив ваш токен:
     {
         "ticket_id": "{{ticket.id}}",
         "topic_id": "{{ticket.external_id}}",
         "email": "{{current_user.email}}",
         "token": "INSERT TOKEN HERE"
     }
  • Нажмите Send Test. Ожидайте ответ 400 Bad Request как положительный сигнал: на экране должна отобразиться HTML-страница, указывающая на успех.

Настройка триггера Zendesk

Настройте триггер в Zendesk для автоматизации действий:

  1. Переход к странице триггеров: Перейдите в раздел Triggers в Zendesk в меню AdminObjects and RulesBusiness RulesTriggers.
    • Пример URL: https://<instance_name>.zendesk.com/admin/objects-rules/rules/triggers
  2. Создание триггера:
    • Нажмите Add trigger.
    • Назовите его “Discourse Sync” и установите категорию “Notifications”.
    • Настройте условия и действия, как показано ниже.



  • Используйте то же тело JSON, что и на шаге тестирования вебхука, снова заменив “INSERT TOKEN HERE” на ваш токен.
  1. Сохранение триггера: После настройки обязательно сохраните триггер.
10 лайков

Hey @techAPJ this is really awesome! Is there a way to set up a triggered sync as opposed to a live sync? i.e. an agent would add a tag in ZD or hit a button or something and only then would the ticket sync to the community?
We are trying to figure out the best way to share common FAQ tickets we get to ZD in the community with the Q&A so that users can find the answers there instead of writing in a ticket.
Thanks!

3 лайка

The only triggered sync we have currently is from Discourse → Zendesk.

Triggering a manual sync from Zendesk → Discourse is tricky since we do not have complete control on Zendesk. That said, I’ll investigate if there is a way to trigger webhook from Zendesk by adding a tag, etc.

3 лайка

@techAPJ did you ever look into ZD to Discourse sync? We are looking at ways to push FAQs from tickets on Zendesk to Discourse!

Hello! I set everything up but it only works from Discourse to Zendesk. I don’t know what I’m missing so that my answers in Zendesk can be published in Discourse

Hi I’m with Marla here ^^^. We got the plugin to work! :tada:

But we’re wondering: is there’s any way to continue the two way sync when/if the topic is moved to a private message? Sometimes, our members will ask for password re-sets and we’d like to continue the conversation within the community.

I have tried the above process, and it’s working fine! :partying_face: However, there’s an issue when a comment in Zendesk contains an attachment—the message is coming through, but the attachment is missing. I’m not sure if there’s an additional parameter that needs to be passed in the webhook to handle attachments. Could someone please clarify if there are any specific parameters required for this?

Thank you!

I’ve just set up the Zendesk plugin and it’s working great. I’d like to enable two-way sync for comments, but I do not want to autogenerate a Zendesk ticket… ever, really.

It looks like syncing comments from ZD->Discourse requires enabling autogeneration. Is that the case, or is there a workaround?

I’ve enable the Zendesk plugin and posting tickets to Zendesk works. But the Webhook in the documentation above (https:///zendesk-plugin/sync) returns a 404 when I test it from the Zendesk Webhook setup page. Subsequently, I can’t update forum posts from Zendesk. What am I doing wrong?

Another issue: If I close the ticket on Zendesk and someone replies to the Discourse post, the closed ticket isn’t re-opened and I miss the new post. Any hints?

Hi Oliver,

I’m sure you’ve already realized this, but the sync URL needs to include your domain. So rather than just https:///zendesk-plugin/sync it might be something like this: https://forum.yoursite.com/zendesk-plugin/sync.

Even after setting the ticket to “Solved” you should still see any Discourse reply on the ZD ticket. You’ll just have to search for the ticket. :slight_smile:

For example, on my test site I created a post and from that a ticket in ZD. I marked the ticket as “Solved” and then posted a reply to the topic on Discourse. I did get a comment on the ZD ticket: