Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateTicketComment wrong return value #269

Open
enumag opened this issue Mar 8, 2023 · 0 comments
Open

CreateTicketComment wrong return value #269

enumag opened this issue Mar 8, 2023 · 0 comments
Labels
Bug Something isn't working
Milestone

Comments

@enumag
Copy link
Contributor

enumag commented Mar 8, 2023

The CreateTicketComment method is trying to load the response from Zendesk back into the TicketComment struct. However the response of the endpoint had a completely different structure which I'm sharing below.

This means that the returned struct is always a zero-value and doesn't contain the data of the newly created comment.

The data of the comment are in the struct under audit.events[0].

{
  "ticket": {
    "url": "https://<redacted>.zendesk.com/api/v2/tickets/2.json",
    "id": 2,
    "external_id": null,
    "via": {
      "channel": "email",
      "source": {
        "from": {
          "address": "[email protected]",
          "name": "Enumag"
        },
        "to": {
          "name": "<redacted>",
          "address": "<redacted>"
        },
        "rel": null
      }
    },
    "created_at": "2023-03-02T12:02:32Z",
    "updated_at": "2023-03-08T14:37:57Z",
    "type": null,
    "subject": "testing ticket",
    "raw_subject": "testing ticket",
    "description": "new testing ticket",
    "priority": null,
    "status": "new",
    "recipient": "<redacted>",
    "requester_id": 13408217713553,
    "submitter_id": 13408217713553,
    "assignee_id": null,
    "organization_id": null,
    "group_id": null,
    "collaborator_ids": [],
    "follower_ids": [],
    "email_cc_ids": [],
    "forum_topic_id": null,
    "problem_id": null,
    "has_incidents": false,
    "is_public": true,
    "due_at": null,
    "tags": [],
    "custom_fields": [
      {
        "id": 13571382524561,
        "value": null
      },
      {
        "id": 13571427625617,
        "value": null
      },
      {
        "id": 13571382547345,
        "value": null
      }
    ],
    "satisfaction_rating": null,
    "sharing_agreement_ids": [],
    "custom_status_id": 12333265000209,
    "fields": [
      {
        "id": 13571382524561,
        "value": null
      },
      {
        "id": 13571427625617,
        "value": null
      },
      {
        "id": 13571382547345,
        "value": null
      }
    ],
    "followup_ids": [],
    "ticket_form_id": 12333269809169,
    "brand_id": 12333264969745,
    "allow_channelback": false,
    "allow_attachments": true,
    "from_messaging_channel": false
  },
  "audit": {
    "id": 13577164093841,
    "ticket_id": 2,
    "created_at": "2023-03-08T14:37:57Z",
    "author_id": 12333884012433,
    "metadata": {
      "system": {
        "client": "Apache-HttpClient/4.5.13 (Java/17.0.5)",
        "ip_address": "<redacted>",
        "location": "<redacted>",
        "latitude": 0,
        "longitude": 0
      },
      "custom": {}
    },
    "events": [
      {
        "id": 13577135544337,
        "type": "Comment",
        "author_id": 12333884012433,
        "body": "Lorem Ipsum Dolor Sit Amet",
        "html_body": "<div class=\"zd-comment\" dir=\"auto\"><p dir=\"auto\">Lorem Ipsum Dolor Sit Amet</p></div>",
        "plain_body": "Lorem Ipsum Dolor Sit Amet",
        "public": true,
        "attachments": [],
        "audit_id": 13577164093841
      },
      {
        "id": 13577135545105,
        "type": "WebhookEvent",
        "via": {
          "channel": "rule",
          "source": {
            "from": {
              "deleted": false,
              "title": "Spaceflow Add Comment Webhook",
              "id": 13571419878673,
              "revision_id": 6
            },
            "rel": "trigger"
          }
        }
      },
      {
        "id": 13577164095633,
        "type": "Notification",
        "via": {
          "channel": "rule",
          "source": {
            "from": {
              "deleted": false,
              "title": "Notify requester and CCs of comment update",
              "id": 12333296041361,
              "revision_id": 1
            },
            "rel": "trigger"
          }
        },
        "subject": "[{{ticket.account}}] Re: {{ticket.title}}",
        "body": "{{ticket.latest_comment_html}}",
        "recipients": [
          13408217713553
        ]
      }
    ],
    "via": {
      "channel": "api",
      "source": {
        "from": {},
        "to": {
          "name": "Enumag",
          "address": "[email protected]"
        },
        "rel": null
      }
    }
  }
}
@nukosuke nukosuke added this to the v0.15.x milestone May 2, 2023
@nukosuke nukosuke added the Bug Something isn't working label May 2, 2023
@nukosuke nukosuke modified the milestones: v0.15.x, v0.17.x Sep 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants