snowplow / snowplow

The leader in Next-Generation Customer Data Infrastructure
http://snowplowanalytics.com
Apache License 2.0
6.84k stars 1.19k forks source link

Zendesk webhook doesn't work when content is localized #3622

Closed razius closed 4 years ago

razius commented 6 years ago

The value of the status field is unfortunately translated when it is pushed to the collector making it fail during validation.

error: instance value ("Løst") not found in enum (possible values: ["New","Open","Pending","On-hold","Solved","Closed"]) level: "error" schema: {"loadingURI":"#","pointer":"/properties/status"} instance: {"pointer":"/status"} domain: "validation" keyword: "enum" value: "Løst" enum: ["New","Open","Pending","On-hold","Solved","Closed"]

See here for additional details.

alexanderdean commented 6 years ago

Thanks for flagging - what a terrible implementation decision by Zendesk...

razius commented 6 years ago

Yes, I agree.

I did the following in the Trigger template to make it work (horrible, I know):

    "status": "{% if ticket.status == 'Nuevo' or ticket.status == 'Neu' or ticket.status == '新建' or ticket.status == 'Nowe' or ticket.status == 'Nouveau' or ticket.status == 'Novo' or ticket.status == 'Nuovo' or ticket.status == 'Nou' or ticket.status == 'Новый' or ticket.status == 'חדשה' or ticket.status == 'Ny' or ticket.status == 'جديدة' or ticket.status == '新規' or ticket.status == '신규' or ticket.status == 'Nový' or ticket.status == 'Uusi' or ticket.status == 'Yeni' or ticket.status == 'Нов' or ticket.status == 'Nieuw' or ticket.status == 'Új' or ticket.status == 'Нова' %}New{% elsif ticket.status == 'Abierto' or ticket.status == 'Offen' or ticket.status == '已開啟' or ticket.status == '已开启' or ticket.status == 'Otwarte' or ticket.status == 'Ouvert' or ticket.status == 'Aberto' or ticket.status == 'Aperto' or ticket.status == 'Deschis' or ticket.status == 'Открыт' or ticket.status == 'פתוחה' or ticket.status == 'Åpen' or ticket.status == 'مفتوحة' or ticket.status == 'オープン' or ticket.status == '등록' or ticket.status == 'Otevřený' or ticket.status == 'Avattu' or ticket.status == 'Açık' or ticket.status == 'Öppen' or ticket.status == 'Отворен' or ticket.status == 'Åben' or ticket.status == 'Nyitott' or ticket.status == 'Відкрита' %}Open{% elsif ticket.status == 'Pendiente' or 'Wartend' or '未決' or '待回应' or 'Oczekujące' or 'En attente' or 'Pendente' or 'In attesa' or 'În așteptare' or 'В ожидании' or 'בהמתנה' or 'Venter på tilbakemelding' or 'قيد العمل' or '保留中' or '보류' or 'Čekající' or 'Odottaa' or 'Beklemede' or 'Väntar' or 'Чакащ' or 'Venter' or 'In afwachting' or 'Függőben' or 'В очікуванні' %}Pending{% elsif ticket.status == 'En espera' or ticket.status == 'Angehalten' or ticket.status == '暫停' or ticket.status == '暂停' or ticket.status == 'Wstrzymane' or ticket.status == 'En pause' or ticket.status == 'Em espera' or ticket.status == 'In sospeso' or ticket.status == 'În pauză' or ticket.status == 'На удержании' or ticket.status == 'מוחזקת' or ticket.status == 'På vent' or ticket.status == 'معلقة' or ticket.status == '待機中' or ticket.status == '대기' or ticket.status == 'Pozastavený' or ticket.status == 'Pidossa' or ticket.status == 'Askıda' or ticket.status == 'Parkerat' or ticket.status == 'Спрян' or ticket.status == 'I bero' or ticket.status == 'Geparkeerd' or ticket.status == 'Felfüggesztve ' %}On-hold{% elsif ticket.status == 'Resuelto' or ticket.status == 'Gelöst' or ticket.status == '已解決' or ticket.status == '已解决' or ticket.status == 'Załatwione' or ticket.status == 'Résolu' or ticket.status == 'Resolvido' or ticket.status == 'Risolto' or ticket.status == 'Rezolvat' or ticket.status == 'Выполнен' or ticket.status == 'פתורה' or ticket.status == 'Løst' or ticket.status == 'محلولة' or ticket.status == '解決済み' or ticket.status == '해결' or ticket.status == 'Vyřešený' or ticket.status == 'Ratkaistu' or ticket.status == 'Çözüldü' or ticket.status == 'Löst' or ticket.status == 'Изпълнен' or ticket.status == 'Opgelost' or ticket.status == 'Megoldva' or ticket.status == 'Вирішена' %}Solved{% elsif ticket.status == 'Cerrado' or ticket.status == 'Geschlossen' or ticket.status == '已關閉' or ticket.status == '已关闭' or ticket.status == 'Zamknięte' or ticket.status == 'Clos' or ticket.status == 'Fechado' or ticket.status == 'Chiuso' or ticket.status == 'Închis' or ticket.status == 'Закрыт' or ticket.status == 'סגורה' or ticket.status == 'Avsluttet' or ticket.status == 'مغلقة' or ticket.status == '終了' or ticket.status == '종료' or ticket.status == 'Uzavřený' or ticket.status == 'Suljettu' or ticket.status == 'Kapalı' or ticket.status == 'Stängt' or ticket.status == 'Затворен' or ticket.status == 'Lukket' or ticket.status == 'Gesloten' or ticket.status == 'Bezárva' or ticket.status == 'Закрита' %}Closed{% else %}{{ ticket.status }}{% endif %}",

Also, ticketType seems to share the same problem.

miike commented 6 years ago

@razius Could you list all the fields you've seen that are subject to the translation issue and I'll patch and update them?

razius commented 6 years ago

status for which you can get the translations from here and ticketType for which I couldn't find the translations so I've just set it to null.

Do you want to do the language mapping or drop the validation?

alexanderdean commented 6 years ago

Good Q @razius - adding @ihortom to the ticket who built the webhook integration on our side...

ihortom commented 6 years ago

@alexanderdean, looks like we do not have much choice as to drop enum:

    . . .
    "priority": {
        "type": ["string", "null"]
    },
    "status": {
        "type": ["string"]
    },
    "tags": {
        "type": ["string", "null"]
    },
    "ticketType": {
        "type": ["string", "null"]
    },
    . . .

That also means amending the table com_zendesk_snowplow_ticket_updated_1 with the extended length of the corresponding VARCHAR fields to cater for longer (non-English) values.

alexanderdean commented 6 years ago

I think you are probably right... It's probably safest to fix this in @stdfalse's data model...

chuwy commented 4 years ago

Migrated to https://github.com/snowplow/enrich/issues/238