diff --git a/src/Billing/Controllers/FreshdeskController.cs b/src/Billing/Controllers/FreshdeskController.cs index 5c6ca9450f..66d4f47d92 100644 --- a/src/Billing/Controllers/FreshdeskController.cs +++ b/src/Billing/Controllers/FreshdeskController.cs @@ -294,18 +294,28 @@ public class FreshdeskController : Controller } // convert note from markdown to html - var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build(); - note = Markdig.Markdown.ToHtml(note, pipeline); + var htmlNote = note; + try + { + var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build(); + htmlNote = Markdig.Markdown.ToHtml(note, pipeline); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error converting markdown to HTML for Freshdesk reply. Ticket Id: {0}. Note: {1}", + ticketId, note); + htmlNote = note; // fallback to the original note + } // clear out any new lines that Freshdesk doesn't like if (_billingSettings.FreshDesk.RemoveNewlinesInReplies) { - note = note.Replace(Environment.NewLine, string.Empty); + htmlNote = htmlNote.Replace(Environment.NewLine, string.Empty); } var replyBody = new FreshdeskReplyRequestModel { - Body = $"{_billingSettings.FreshDesk.AutoReplyGreeting}{note}{_billingSettings.FreshDesk.AutoReplySalutation}", + Body = $"{_billingSettings.FreshDesk.AutoReplyGreeting}{htmlNote}{_billingSettings.FreshDesk.AutoReplySalutation}", }; var replyRequest = new HttpRequestMessage(HttpMethod.Post, diff --git a/src/Billing/appsettings.json b/src/Billing/appsettings.json index 05e8a0b845..2ec03b79aa 100644 --- a/src/Billing/appsettings.json +++ b/src/Billing/appsettings.json @@ -74,8 +74,8 @@ "userFieldName": "cf_user", "orgFieldName": "cf_org", "removeNewlinesInReplies": true, - "autoReplyGreeting": "Greetings,

Thank you for contacting Bitwarden. The reply below was generated by our AI agent based on your message:

", - "autoReplySalutation": "

If this response doesn’t fully address your question, simply reply to this email and a member of our Customer Success team will be happy to assist you further.

Regards,
CS Team

" + "autoReplyGreeting": "Greetings,

Thank you for contacting Bitwarden. The reply below was generated by our AI agent based on your message:

", + "autoReplySalutation": "

If this response doesn’t fully address your question, simply reply to this email and a member of our Customer Success team will be happy to assist you further.

Best Regards,
The Bitwarden Customer Success Team

" }, "onyx": { "apiKey": "on_tenant_i-16a83ec44869babc4.aDffNn2k4UvtRt_9KdlV_3lfjiLFdOe4mdAiE3jJb4thWUGURVETwFg1Xrtg5rwLvfqfcw_F6U0V87arVkARd7qHQxmL5vaC4k8gPxh3hTKJKEE7Rkc3BJHOSAiT-leINjWvj44hpIuTRcWazz_zafZi-_D6123wplCb3PG6UtiGlyxcK8FJCZKp9IEM4UTTYXUHc7nWUVZuhiREGPd5J7T8LIWoenfkSJ1Vhi2PoLDI6msMOLfSGuLT_Ma_pJZl",