Skip to content

Create a mock local zendesk server for local ticket create flow testing - #8448

Open
jdolle wants to merge 4 commits into
mainfrom
local-zendesk-testing
Open

Create a mock local zendesk server for local ticket create flow testing#8448
jdolle wants to merge 4 commits into
mainfrom
local-zendesk-testing

Conversation

@jdolle

@jdolle jdolle commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Background

Currently, we have no good way of running or verifying the zendesk ticket creation flow locally. Sandbox environments in zendesk require significantly more $$ and we only very rarely modify this flow.

We needed a way to run our development server and easily view and modify this page like any other page in our app.

Description

Adds unit tests for the support-manager to ensure requirements are met, and adds a mock instance for local development testing.

During local testing, the mock data captured (via curl -s -X PUT 'http://localhost:3043/mockserver/retrieve?type=REQUESTS' | jq) was:

[
  {
    "body": {
      "contentType": "application/json",
      "type": "JSON",
      "json": {
        "organization": {
          "name": "sadasfasdfasd (47587f20-3011-4f59-a585-38d67f8a94fd)",
          "external_id": "47587f20-3011-4f59-a585-38d67f8a94fd"
        }
      },
      "rawBytes": "eyJvcmdhbml6YXRpb24iOnsibmFtZSI6InNhZGFzZmFzZGZhc2QgKDQ3NTg3ZjIwLTMwMTEtNGY1OS1hNTg1LTM4ZDY3ZjhhOTRmZCkiLCJleHRlcm5hbF9pZCI6IjQ3NTg3ZjIwLTMwMTEtNGY1OS1hNTg1LTM4ZDY3ZjhhOTRmZCJ9fQ=="
    },
    "headers": {
      "authorization": [
        "Basic bW9jazptb2Nr"
      ],
      "content-length": [
        "133"
      ],
      "idempotency-key": [
        "47587f20-3011-4f59-a585-38d67f8a94fd"
      ],
      "Connection": [
        "keep-alive"
      ],
      "content-type": [
        "application/json"
      ],
      "Host": [
        "localhost:3043"
      ],
      "accept-encoding": [
        "gzip, deflate, br"
      ],
      "user-agent": [
        ""
      ],
      "accept": [
        "application/json"
      ]
    },
    "keepAlive": true,
    "method": "POST",
    "path": "/local/api/v2/organizations",
    "secure": false
  },
  {
    "headers": {
      "authorization": [
        "Basic bW9jazptb2Nr"
      ],
      "content-length": [
        "0"
      ],
      "Connection": [
        "keep-alive"
      ],
      "Host": [
        "localhost:3043"
      ],
      "accept-encoding": [
        "gzip, deflate, br"
      ],
      "user-agent": [
        ""
      ],
      "accept": [
        "application/json"
      ]
    },
    "keepAlive": true,
    "method": "GET",
    "path": "/local/api/v2/organizations/1000/tickets",
    "queryStringParameters": {
      "sort": [
        "-updated_at"
      ],
      "page[size]": [
        "100"
      ]
    },
    "secure": false
  },
  {
    "headers": {
      "authorization": [
        "Basic bW9jazptb2Nr"
      ],
      "content-length": [
        "0"
      ],
      "Connection": [
        "keep-alive"
      ],
      "Host": [
        "localhost:3043"
      ],
      "accept-encoding": [
        "gzip, deflate, br"
      ],
      "user-agent": [
        ""
      ],
      "accept": [
        "application/json"
      ]
    },
    "keepAlive": true,
    "method": "GET",
    "path": "/local/api/v2/users/search",
    "queryStringParameters": {
      "query": [
        "[email protected]"
      ]
    },
    "secure": false
  },
  {
    "body": {
      "contentType": "application/json",
      "type": "JSON",
      "json": {
        "user": {
          "name": "asdf asdf",
          "email": "[email protected]",
          "external_id": "010a5acb-1b38-46c9-a98e-eb52f4a17970",
          "identities": [
            {
              "type": "foreign",
              "value": "[email protected]"
            }
          ],
          "role": "end-user",
          "verified": true
        },
        "skip_verify_email": true
      },
      "rawBytes": "eyJ1c2VyIjp7Im5hbWUiOiJhc2RmIGFzZGYiLCJlbWFpbCI6ImRvb0Bhc2RmLmNvbSIsImV4dGVybmFsX2lkIjoiMDEwYTVhY2ItMWIzOC00NmM5LWE5OGUtZWI1MmY0YTE3OTcwIiwiaWRlbnRpdGllcyI6W3sidHlwZSI6ImZvcmVpZ24iLCJ2YWx1ZSI6ImRvb0Bhc2RmLmNvbSJ9XSwicm9sZSI6ImVuZC11c2VyIiwidmVyaWZpZWQiOnRydWV9LCJza2lwX3ZlcmlmeV9lbWFpbCI6dHJ1ZX0="
    },
    "headers": {
      "authorization": [
        "Basic bW9jazptb2Nr"
      ],
      "content-length": [
        "221"
      ],
      "idempotency-key": [
        "010a5acb-1b38-46c9-a98e-eb52f4a17970"
      ],
      "Connection": [
        "keep-alive"
      ],
      "content-type": [
        "application/json"
      ],
      "Host": [
        "localhost:3043"
      ],
      "accept-encoding": [
        "gzip, deflate, br"
      ],
      "user-agent": [
        ""
      ],
      "accept": [
        "application/json"
      ]
    },
    "keepAlive": true,
    "method": "POST",
    "path": "/local/api/v2/users",
    "secure": false
  },
  {
    "body": {
      "contentType": "application/json",
      "type": "JSON",
      "json": {
        "organization_membership": {
          "user_id": 2000,
          "organization_id": 1000
        }
      },
      "rawBytes": "eyJvcmdhbml6YXRpb25fbWVtYmVyc2hpcCI6eyJ1c2VyX2lkIjoyMDAwLCJvcmdhbml6YXRpb25faWQiOjEwMDB9fQ=="
    },
    "headers": {
      "authorization": [
        "Basic bW9jazptb2Nr"
      ],
      "content-length": [
        "67"
      ],
      "idempotency-key": [
        "010a5acb-1b38-46c9-a98e-eb52f4a17970|v2"
      ],
      "Connection": [
        "keep-alive"
      ],
      "content-type": [
        "application/json"
      ],
      "Host": [
        "localhost:3043"
      ],
      "accept-encoding": [
        "gzip, deflate, br"
      ],
      "user-agent": [
        ""
      ],
      "accept": [
        "application/json"
      ]
    },
    "keepAlive": true,
    "method": "POST",
    "path": "/local/api/v2/organization_memberships",
    "secure": false
  },
  {
    "body": {
      "contentType": "application/json",
      "type": "JSON",
      "json": {
        "ticket": {
          "organization_id": 1000,
          "submitter_id": 2000,
          "requester_id": 2000,
          "comment": {
            "body": "asdfasdasfa"
          },
          "priority": "normal",
          "subject": "Test!",
          "custom_fields": [
            {
              "id": 18185379454865,
              "value": "hobby_customer"
            }
          ]
        }
      },
      "rawBytes": "eyJ0aWNrZXQiOnsib3JnYW5pemF0aW9uX2lkIjoxMDAwLCJzdWJtaXR0ZXJfaWQiOjIwMDAsInJlcXVlc3Rlcl9pZCI6MjAwMCwiY29tbWVudCI6eyJib2R5IjoiYXNkZmFzZGFzZmEifSwicHJpb3JpdHkiOiJub3JtYWwiLCJzdWJqZWN0IjoiVGVzdCEiLCJjdXN0b21fZmllbGRzIjpbeyJpZCI6MTgxODUzNzk0NTQ4NjUsInZhbHVlIjoiaG9iYnlfY3VzdG9tZXIifV19fQ=="
    },
    "headers": {
      "authorization": [
        "Basic bW9jazptb2Nr"
      ],
      "content-length": [
        "211"
      ],
      "idempotency-key": [
        "e7a4a48464b182f577374815de31ddb07dc0e6b96bc55fe63f9e7231a2838de0"
      ],
      "Connection": [
        "keep-alive"
      ],
      "content-type": [
        "application/json"
      ],
      "Host": [
        "localhost:3043"
      ],
      "accept-encoding": [
        "gzip, deflate, br"
      ],
      "user-agent": [
        ""
      ],
      "accept": [
        "application/json"
      ]
    },
    "keepAlive": true,
    "method": "POST",
    "path": "/local/api/v2/tickets",
    "secure": false
  },
  {
    "headers": {
      "authorization": [
        "Basic bW9jazptb2Nr"
      ],
      "content-length": [
        "0"
      ],
      "Connection": [
        "keep-alive"
      ],
      "Host": [
        "localhost:3043"
      ],
      "accept-encoding": [
        "gzip, deflate, br"
      ],
      "user-agent": [
        ""
      ],
      "accept": [
        "application/json"
      ]
    },
    "keepAlive": true,
    "method": "GET",
    "path": "/local/api/v2/organizations/1000/tickets",
    "queryStringParameters": {
      "sort": [
        "-updated_at"
      ],
      "page[size]": [
        "100"
      ]
    },
    "secure": false
  }
]

Checklist

  • Testing

@jdolle jdolle self-assigned this Sep 9, 2026
@theguild-bot

theguild-bot commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
hive 11.13.0-alpha-20260909160306-697d65130accfbae8c49378884ddd051c30d5e19 npm ↗︎ unpkg ↗︎

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🐋 This PR was built and pushed to the following Docker images:

Targets: build

Platforms: linux/amd64

Image Tags: 11.13.0-alpha-697d651, 697d651, 697d65130accfbae8c49378884ddd051c30d5e19

Comment on lines +104 to +105
ZENDESK_SUBDOMAIN: zod.string(),
ZENDESK_BASE_URL: emptyString(zod.string().optional()),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not simply remove the ZENDESK_SUBDOMAIN option in favor of ZENDESK_BASE_URL? I don't see a need to keep backwards compat here as this is not really an option that self-hosters use.

Also the ${this.config.baseUrl}/${this.config.subdomain} concat is a bit weird to me.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusted. We'll need to add zendesk:baseUrl=https://theguild.zendesk.com to our pulumi config before deploying.

@n1ru4l n1ru4l left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment. Not a blocker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants