Menu

SyntaxError: Unexpected token < in JSON at position 0 - Webhook Integration (ITOMIG GmbH) v 21.1.0, iTop 3.0.00-beta5-8216

2021-11-29
2021-12-09
  • Michael Newman

    Michael Newman - 2021-11-29

    Hey all,

    I'm working on setting up Slack integration with iTop 3.0.0-beta5 using v21.1.0 of the Webhook Integration found here. I appear to have successfully installed the extension (put in Extensions folder, reinstalled iTop, have the appropriate php modules set up, restarted Apache). I have created a trigger on public log update that should both send an email to caller and send a Slack notification to a channel in my Slack workspace.

    When I post a public log update, however, Chrome gives me an error "SyntaxError: Unexpected token < in JSON at position 0" and the Slack message does not send. The email trigger works fine.

    I'm at a loss. Based on searches, I suspect maybe I've got issues with cURL, but I have activated cURL and have successfully run a script that suggests it is appropriately installed.

    Any thoughts? Details of everything below:

    Server OS: Windows 10
    Apache version: 2.4
    PHP version: 7
    iTop version: 3.0.0-beta5-8216
    Webhook Integration version: 21.1.0
    Chrome version: 94.0.4606.71 (Official Build) (64-bit)

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2021-11-29

    Can you debug and see what input you do receive? Probably non JSON format, but still some form of response?

     
    • Michael Newman

      Michael Newman - 2021-11-29

      I'm not too technically inclined, so please feel free to let me know if you need something more specific:

      When I click "Send" on the ticket, I get the error and this is what I have in
      "Headers":
      Request URL: http://localhost/itop/pages/ajax.render.php
      Request Method: POST
      Status Code: 200 OK
      Remote Address: [::1]:80
      Referrer Policy: strict-origin-when-cross-origin
      Cache-Control: no-store, no-cache, must-revalidate
      Connection: Keep-Alive
      Content-Length: 1914
      Content-Type: application/json
      Date: Mon, 29 Nov 2021 15:45:10 GMT
      Expires: Thu, 19 Nov 1981 08:52:00 GMT
      Keep-Alive: timeout=5, max=100
      Pragma: no-cache
      Server: Apache/2.4.51 (Win32) PHP/7.4.25
      X-Powered-By: PHP/7.4.25
      Accept: /
      Accept-Encoding: gzip, deflate, br
      Accept-Language: en-US,en;q=0.9
      Connection: keep-alive
      Content-Length: 204
      Content-Type: application/x-www-form-urlencoded; charset=UTF-8
      Cookie: itop-9be5fdf7259bf7ec68c06ec49a647575=vcc5t1d48ji98ogtnop1ntf42f
      Host: localhost
      Origin: http://localhost
      Referer: http://localhost/itop/pages/UI.php?operation=details&class=UserRequest&id=7&c[menu]=UserRequest%3AOpenRequests
      sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="96", "Google Chrome";v="96"
      sec-ch-ua-mobile: ?0
      sec-ch-ua-platform: "Windows"
      Sec-Fetch-Dest: empty
      Sec-Fetch-Mode: cors
      Sec-Fetch-Site: same-origin
      User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36
      X-Combodo-Ajax: true
      X-Requested-With: XMLHttpRequest

      Payload:
      operation: activity_panel_add_caselog_entries
      object_class: UserRequest
      object_id: 7
      transaction_id: admEEAB.tmp
      entries[public_log][value]:

      test


      entries[public_log][rank]: 1**

      Preview and response are both blank

      Then, I click "OK" on the error itself and it updates as follows:
      Headers
      Request URL: http://localhost/itop/pages/ajax.render.php
      Request Method: POST
      Status Code: 200 OK
      Remote Address: [::1]:80
      Referrer Policy: strict-origin-when-cross-origin
      Cache-Control: no-store, no-cache, must-revalidate
      Connection: Keep-Alive
      Content-Length: 1914
      Content-Type: application/json
      Date: Mon, 29 Nov 2021 15:45:10 GMT
      Expires: Thu, 19 Nov 1981 08:52:00 GMT
      Keep-Alive: timeout=5, max=100
      Pragma: no-cache
      Server: Apache/2.4.51 (Win32) PHP/7.4.25
      X-Powered-By: PHP/7.4.25
      Accept: /
      Accept-Encoding: gzip, deflate, br
      Accept-Language: en-US,en;q=0.9
      Connection: keep-alive
      Content-Length: 204
      Content-Type: application/x-www-form-urlencoded; charset=UTF-8
      Cookie: itop-9be5fdf7259bf7ec68c06ec49a647575=vcc5t1d48ji98ogtnop1ntf42f
      Host: localhost
      Origin: http://localhost
      Referer: http://localhost/itop/pages/UI.php?operation=details&class=UserRequest&id=7&c[menu]=UserRequest%3AOpenRequests
      sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="96", "Google Chrome";v="96"
      sec-ch-ua-mobile: ?0
      sec-ch-ua-platform: "Windows"
      Sec-Fetch-Dest: empty
      Sec-Fetch-Mode: cors
      Sec-Fetch-Site: same-origin
      User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36
      X-Combodo-Ajax: true
      X-Requested-With: XMLHttpRequest

      Payload
      operation: activity_panel_add_caselog_entries
      object_class: UserRequest
      object_id: 7
      transaction_id: admEEAB.tmp
      entries[public_log][value]:

      test


      entries[public_log][rank]: 1

      Preview

      Warning: Creating default object from empty value in C:\Apache24\htdocs\itop\env-production\itomig-webhook-integration-master\main.itomig-webhook-integration.phpon line90
      {
      "data": {
      "success": true,
      "entries": {
      "public_log": {
      "html_rendering": "

       
  • Pierre Goiffon

    Pierre Goiffon - 2021-12-09

    Hello,

    Unfortunately I can't answer on this as this extension was done by Itomig and not by Combodo.
    Note that Itomig is a Combodo partner though ; and I can assure they do a fantastic job with iTop and its ecosystem !

    Note also that final 3.0.0 (both products and community) will include a webhooks integration done by Combodo, including a Slack integration for notifications. For now this module is in its own repository but in the end it will be included in iTop repo.
    The development is in its final stages now !

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.