Customer info from remote system

Is it possible to have the Customer sidebar be populated by info from a remote api call instead of from local data? So we could make a call to our CRM with the email address as the key to get various information about the customer and display it in the sidebar?

You could add a new sidebar like this:

app/assets/javascripts/app/controllers/ticket_zoom/sidebar_custom.coffee

class SidebarCustom extends App.Controller
  sidebarItem: =>
    @item = {
      name: 'Custom'
      badgeIcon: 'templates'
      sidebarHead: __('Custom')
      sidebarCallback: @showCustom
    }
    @item

  shown: ->
    @showCustom(undefined, true)

  showCustom: (el, load = false) =>
    @elSidebar = el if el

    @startLoading()
    return if !load

    console.log('sidebar data', @ticket)

    @ajax(
      id:    "Custom_#{@ticket.id}"
      type:  'GET'
      url:   "#{@apiPath}/tickets/#{@ticket.id}"
      processData: true
      success: (data, status, xhr) =>
        console.log('endpoint data ', data)
        @stopLoading()
        @elSidebar.html('<p>Custom information for customer id ' + @ticket.customer_id + '</p>')
    )

App.Config.set('310-Custom', SidebarCustom, 'TicketZoomSidebar')

You might get problems when you requesting remote urls because of the CSP I guess.

https://github.com/zammad/zammad/blob/93cbf90f042778d013431f5131f1e1a917a7c14b/config/initializers/content_security_policy.rb

not sure how to edit it properly atm. You could also think about to add a new controller and proxy your data through that alternatively.

For packages there are some small tutorials here

This topic was automatically closed after 360 days. New replies are no longer allowed.