Junco Guides

Apps, engines and desktop

In short. Outside a web page there are two ways in. The hosted page: turn it on for the product and open https://desk.juncodesk.app/s/jk_... from a Help menu; no code. The API: build your own form with four HTTP calls, sending a random id you make once per install in the X-Junco-Player header. Native apps send no Origin header, so no web address needs listing. Complete code below for Unity, Godot, Swift, Kotlin, Flutter and React Native.

Which to use

Hosted page API
Code One line to open a URL A small client and your own screens
Looks like Junco's page (light and dark), in a browser Your app
Game state, screenshot, save, log No (device, screen size and language only) Yes
Signed-in users follow their account No: one browser, one user Yes, with signed tokens
Products that only allow signed-in users Doesn't work Works
Users see replies When they open the page again Where you show them (poll GET /unread for a badge)

Start with the hosted page if you want support working today; move to the API when you want game state and screenshots.

The hosted page

  1. On the product's page in Junco, turn on Junco's support page.
  2. Open https://desk.juncodesk.app/s/jk_YOUR_PUBLIC_KEY from your Help or Support menu, your store listing, your Discord or your website.
Platform Open it with
iOS SFSafariViewController or UIApplication.shared.open(url)
Android Custom Tabs (CustomTabsIntent) or Intent.ACTION_VIEW
Unity Application.OpenURL(url)
Godot OS.shell_open(url)
Unreal FPlatformProcess::LaunchURL(*Url, nullptr, nullptr)
Flutter launchUrl(Uri.parse(url)) (url_launcher)
React Native Linking.openURL(url)
Electron shell.openExternal(url)

The page can't be put in an iframe. It remembers the user in that browser, so open it the same way each time. It needs "Without an account" on for the product.

The API

Everything is under https://desk.juncodesk.app/v1/games/<public key>/. The full reference is API; OpenAPI: https://desk.juncodesk.app/openapi.json. The four calls a form needs:

Call Does
POST /tickets with {"type", "text", "context"} Raise a ticket (type: bug, idea or help). 201 with the ticket and its messages.
GET /tickets The user's tickets, each with unread.
GET /tickets/<number> One ticket's messages (marks it read). While aiWorking is true, ask again every 2 seconds or so.
POST /tickets/<number>/messages with {"text"} The user replies.

Plus GET /unread ({"count"}, for a badge) and DELETE /me (the user deletes everything they've sent; offer it in your settings). Errors are {"error": "..."} in words you can show the user.

The user's id. Make 24 random bytes, encode them as URL-safe base64 without padding (32 characters) or as hex (48), store it, and send it as X-Junco-Player on every call. Losing it loses access to their old tickets; keep it with the user's other settings. If your users sign in, send Authorization: Bearer <token> from your server instead (Signed user tokens).

Screenshots and files. Send multipart/form-data instead of JSON: a ticket field holding the same JSON as text, and up to three files named screenshot (PNG, JPEG or WebP, under 2 MB), save (under 1 MB) and log (UTF-8 text, under 512 KB).

Unity (C#)

Works in Unity 2020.3 and later, on every platform, with no packages.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;
using UnityEngine;
using UnityEngine.Networking;

// Add to a GameObject in your first scene; call from your UI with StartCoroutine(...).
public class JuncoSupport : MonoBehaviour
{
    const string Server = "https://desk.juncodesk.app";
    const string PublicKey = "jk_YOUR_PUBLIC_KEY";
    static string Base => $"{Server}/v1/games/{PublicKey}";

    [Serializable] public class Message { public string id; public string @from; public string text; public string at; }
    [Serializable] public class Ticket { public int number; public string type; public string status; public string stage; public string title; public bool unread; public bool aiWorking; public Message[] messages; }
    [Serializable] class TicketList { public Ticket[] tickets; }
    [Serializable] class Unread { public int count; }
    [Serializable] class ApiError { public string error; }
    [Serializable] class Context { public string version; public string platform; public string device; public string os; public string scene; public string language; }
    [Serializable] class NewTicket { public string type; public string text; public Context context; }
    [Serializable] class NewReply { public string text; }

    static string PlayerId
    {
        get
        {
            var id = PlayerPrefs.GetString("junco_player", "");
            if (id.Length >= 32) return id;
            var bytes = new byte[24];
            using (var rng = RandomNumberGenerator.Create()) rng.GetBytes(bytes);
            id = Convert.ToBase64String(bytes).Replace('+', '-').Replace('/', '_').TrimEnd('=');
            PlayerPrefs.SetString("junco_player", id);
            PlayerPrefs.Save();
            return id;
        }
    }

    // type: "bug", "idea" or "help". Takes a screenshot first if asked.
    public IEnumerator Report(string type, string text, bool withScreenshot, Action<Ticket> done, Action<string> failed)
    {
        byte[] shot = null;
        if (withScreenshot)
        {
            yield return new WaitForEndOfFrame();
            var tex = ScreenCapture.CaptureScreenshotAsTexture();
            shot = tex.EncodeToJPG(60);
            Destroy(tex);
            if (shot.Length > 2_000_000) shot = null; // over Junco's 2 MB limit: send without it
        }
        var ticket = new NewTicket
        {
            type = type, text = text,
            context = new Context
            {
                version = Application.version, platform = Application.platform.ToString(),
                device = SystemInfo.deviceModel, os = SystemInfo.operatingSystem,
                scene = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name,
                language = Application.systemLanguage.ToString(),
            },
        };
        var form = new List<IMultipartFormSection> { new MultipartFormDataSection("ticket", JsonUtility.ToJson(ticket)) };
        if (shot != null) form.Add(new MultipartFormFileSection("screenshot", shot, "screenshot.jpg", "image/jpeg"));
        using var req = UnityWebRequest.Post($"{Base}/tickets", form);
        yield return Send(req, json => done(JsonUtility.FromJson<Ticket>(json)), failed);
    }

    public IEnumerator Tickets(Action<Ticket[]> done, Action<string> failed)
    {
        using var req = UnityWebRequest.Get($"{Base}/tickets");
        yield return Send(req, json => done(JsonUtility.FromJson<TicketList>(json).tickets), failed);
    }

    public IEnumerator Open(int number, Action<Ticket> done, Action<string> failed)
    {
        using var req = UnityWebRequest.Get($"{Base}/tickets/{number}");
        yield return Send(req, json => done(JsonUtility.FromJson<Ticket>(json)), failed);
    }

    public IEnumerator Reply(int number, string text, Action<Ticket> done, Action<string> failed)
    {
        using var req = new UnityWebRequest($"{Base}/tickets/{number}/messages", "POST");
        req.uploadHandler = new UploadHandlerRaw(Encoding.UTF8.GetBytes(JsonUtility.ToJson(new NewReply { text = text })));
        req.downloadHandler = new DownloadHandlerBuffer();
        req.SetRequestHeader("Content-Type", "application/json");
        yield return Send(req, json => done(JsonUtility.FromJson<Ticket>(json)), failed);
    }

    public IEnumerator UnreadCount(Action<int> done)
    {
        using var req = UnityWebRequest.Get($"{Base}/unread");
        yield return Send(req, json => done(JsonUtility.FromJson<Unread>(json).count), _ => done(0));
    }

    static IEnumerator Send(UnityWebRequest req, Action<string> ok, Action<string> failed)
    {
        req.SetRequestHeader("X-Junco-Player", PlayerId);
        yield return req.SendWebRequest();
        var body = req.downloadHandler?.text ?? "";
        if (req.result == UnityWebRequest.Result.Success) { ok(body); yield break; }
        var err = body.StartsWith("{") ? JsonUtility.FromJson<ApiError>(body)?.error : null;
        failed(err ?? "Couldn't reach support. Try again in a moment.");
    }
}

JsonUtility can't read dictionaries, so context is a class: add the fields you want. To show replies arriving, call Open every 2 seconds while aiWorking is true. WebGL builds: use the widget in the page template instead (Installing the form).

Godot 4 (GDScript)

# junco.gd: add as an autoload named Junco. Calls one at a time (HTTPRequest is single-use).
extends Node

const SERVER := "https://desk.juncodesk.app"
const KEY := "jk_YOUR_PUBLIC_KEY"
var _http := HTTPRequest.new()

func _ready() -> void:
	add_child(_http)

func player_id() -> String:
	var cfg := ConfigFile.new()
	cfg.load("user://junco.cfg")
	var id: String = cfg.get_value("junco", "player", "")
	if id.length() < 32:
		id = Crypto.new().generate_random_bytes(24).hex_encode() # 48 hex characters
		cfg.set_value("junco", "player", id)
		cfg.save("user://junco.cfg")
	return id

func _context() -> Dictionary:
	return {
		"version": ProjectSettings.get_setting("application/config/version", ""),
		"os": OS.get_name(),
		"device": OS.get_model_name(),
		"scene": get_tree().current_scene.scene_file_path if get_tree().current_scene else "",
		"language": OS.get_locale(),
	}

# Returns the answer as a Dictionary; on failure, {"error": "..."} to show the user.
func _call(path: String, method := HTTPClient.METHOD_GET, body = null) -> Dictionary:
	var headers := PackedStringArray(["X-Junco-Player: " + player_id()])
	var data := ""
	if body != null:
		headers.append("Content-Type: application/json")
		data = JSON.stringify(body)
	var err := _http.request(SERVER + "/v1/games/" + KEY + path, headers, method, data)
	if err != OK:
		return {"error": "Couldn't reach support."}
	var res: Array = await _http.request_completed # [result, code, headers, body]
	var parsed = JSON.parse_string(res[3].get_string_from_utf8())
	if typeof(parsed) != TYPE_DICTIONARY:
		return {"error": "Couldn't reach support."}
	return parsed

func report(type: String, text: String) -> Dictionary:
	return await _call("/tickets", HTTPClient.METHOD_POST, {"type": type, "text": text, "context": _context()})

func tickets() -> Array:
	return (await _call("/tickets")).get("tickets", [])

func open_ticket(number: int) -> Dictionary:
	return await _call("/tickets/%d" % number)

func reply(number: int, text: String) -> Dictionary:
	return await _call("/tickets/%d/messages" % number, HTTPClient.METHOD_POST, {"text": text})

func unread() -> int:
	return int((await _call("/unread")).get("count", 0))

# A report with a screenshot, as multipart/form-data.
func report_with_screenshot(type: String, text: String) -> Dictionary:
	var img := get_viewport().get_texture().get_image()
	if img.get_width() > 1280:
		img.resize(1280, int(img.get_height() * 1280.0 / img.get_width()))
	var jpg := img.save_jpg_to_buffer(0.7)
	var b := "junco" + str(randi())
	var body := PackedByteArray()
	body.append_array(("--%s\r\nContent-Disposition: form-data; name=\"ticket\"\r\n\r\n%s\r\n" % [b, JSON.stringify({"type": type, "text": text, "context": _context()})]).to_utf8_buffer())
	body.append_array(("--%s\r\nContent-Disposition: form-data; name=\"screenshot\"; filename=\"screenshot.jpg\"\r\nContent-Type: image/jpeg\r\n\r\n" % b).to_utf8_buffer())
	body.append_array(jpg)
	body.append_array(("\r\n--%s--\r\n" % b).to_utf8_buffer())
	var headers := PackedStringArray(["X-Junco-Player: " + player_id(), "Content-Type: multipart/form-data; boundary=" + b])
	_http.request_raw(SERVER + "/v1/games/" + KEY + "/tickets", headers, HTTPClient.METHOD_POST, body)
	var res: Array = await _http.request_completed
	var parsed = JSON.parse_string(res[3].get_string_from_utf8())
	return parsed if typeof(parsed) == TYPE_DICTIONARY else {"error": "Couldn't reach support."}

Use it with var t = await Junco.report("bug", text); check t.has("error"). Web exports: use the widget in the HTML shell instead.

iOS (Swift)

import Foundation
import UIKit

struct JuncoMessage: Decodable { let id: String; let from: String; let text: String; let at: String }
struct JuncoTicket: Decodable {
    let number: Int; let type: String; let status: String; let stage: String?
    let title: String; let unread: Bool; let messages: [JuncoMessage]?; let aiWorking: Bool?
}
struct JuncoError: Error, Decodable { let error: String }

enum Junco {
    static let server = "https://desk.juncodesk.app"
    static let key = "jk_YOUR_PUBLIC_KEY"

    static var playerId: String {
        if let id = UserDefaults.standard.string(forKey: "junco.player"), id.count >= 32 { return id }
        var bytes = [UInt8](repeating: 0, count: 24)
        _ = SecRandomCopyBytes(kSecRandomDefault, bytes.count, &bytes)
        let id = bytes.map { String(format: "%02x", $0) }.joined()
        UserDefaults.standard.set(id, forKey: "junco.player")
        return id
    }

    private static func call<T: Decodable>(_ path: String, method: String = "GET", body: [String: Any]? = nil) async throws -> T {
        var req = URLRequest(url: URL(string: "\(server)/v1/games/\(key)\(path)")!)
        req.httpMethod = method
        req.setValue(playerId, forHTTPHeaderField: "X-Junco-Player")
        if let body {
            req.httpBody = try JSONSerialization.data(withJSONObject: body)
            req.setValue("application/json", forHTTPHeaderField: "Content-Type")
        }
        let (data, response) = try await URLSession.shared.data(for: req)
        let code = (response as? HTTPURLResponse)?.statusCode ?? 0
        guard (200..<300).contains(code) else {
            throw (try? JSONDecoder().decode(JuncoError.self, from: data)) ?? JuncoError(error: "Couldn't reach support. Try again in a moment.")
        }
        return try JSONDecoder().decode(T.self, from: data)
    }

    /// type: "bug", "idea" or "help"
    @MainActor static func report(_ type: String, _ text: String, screen: String) async throws -> JuncoTicket {
        let info = Bundle.main.infoDictionary ?? [:]
        let context: [String: Any] = [
            "version": info["CFBundleShortVersionString"] ?? "", "build": info["CFBundleVersion"] ?? "",
            "os": "\(UIDevice.current.systemName) \(UIDevice.current.systemVersion)",
            "device": UIDevice.current.model, "screen": screen, "language": Locale.preferredLanguages.first ?? "",
        ]
        return try await call("/tickets", method: "POST", body: ["type": type, "text": text, "context": context])
    }

    struct List: Decodable { let tickets: [JuncoTicket] }
    struct Count: Decodable { let count: Int }
    static func tickets() async throws -> [JuncoTicket] { try await (call("/tickets") as List).tickets }
    static func ticket(_ number: Int) async throws -> JuncoTicket { try await call("/tickets/\(number)") }
    static func reply(_ number: Int, _ text: String) async throws -> JuncoTicket { try await call("/tickets/\(number)/messages", method: "POST", body: ["text": text]) }
    static func unread() async throws -> Int { try await (call("/unread") as Count).count }
}

Errors are JuncoError; show error.error to the user. A message's from is player (the user), ai or staff.

Android (Kotlin)

No libraries beyond Kotlin coroutines; org.json is part of Android.

import android.content.Context
import android.os.Build
import android.util.Base64
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.json.JSONObject
import java.io.IOException
import java.net.HttpURLConnection
import java.net.URL
import java.security.SecureRandom

object Junco {
    private const val SERVER = "https://desk.juncodesk.app"
    private const val KEY = "jk_YOUR_PUBLIC_KEY"

    private fun playerId(ctx: Context): String {
        val prefs = ctx.getSharedPreferences("junco", Context.MODE_PRIVATE)
        prefs.getString("player", null)?.takeIf { it.length >= 32 }?.let { return it }
        val bytes = ByteArray(24).also { SecureRandom().nextBytes(it) }
        val id = Base64.encodeToString(bytes, Base64.URL_SAFE or Base64.NO_PADDING or Base64.NO_WRAP)
        prefs.edit().putString("player", id).apply()
        return id
    }

    /** Throws IOException with a message you can show the user. */
    private suspend fun call(ctx: Context, path: String, method: String = "GET", body: JSONObject? = null): JSONObject =
        withContext(Dispatchers.IO) {
            val conn = URL("$SERVER/v1/games/$KEY$path").openConnection() as HttpURLConnection
            try {
                conn.requestMethod = method
                conn.setRequestProperty("X-Junco-Player", playerId(ctx))
                if (body != null) {
                    conn.doOutput = true
                    conn.setRequestProperty("Content-Type", "application/json")
                    conn.outputStream.use { it.write(body.toString().toByteArray()) }
                }
                val ok = conn.responseCode in 200..299
                val text = (if (ok) conn.inputStream else conn.errorStream)?.bufferedReader()?.use { it.readText() } ?: "{}"
                val json = runCatching { JSONObject(text) }.getOrDefault(JSONObject())
                if (!ok) throw IOException(json.optString("error", "Couldn't reach support. Try again in a moment."))
                json
            } finally {
                conn.disconnect()
            }
        }

    /** type: "bug", "idea" or "help" */
    suspend fun report(ctx: Context, type: String, text: String, screen: String): JSONObject {
        val info = ctx.packageManager.getPackageInfo(ctx.packageName, 0)
        val context = JSONObject()
            .put("version", info.versionName)
            .put("android", Build.VERSION.RELEASE)
            .put("device", "${Build.MANUFACTURER} ${Build.MODEL}")
            .put("screen", screen)
            .put("language", java.util.Locale.getDefault().toLanguageTag())
        return call(ctx, "/tickets", "POST", JSONObject().put("type", type).put("text", text).put("context", context))
    }

    suspend fun tickets(ctx: Context) = call(ctx, "/tickets").getJSONArray("tickets")
    suspend fun ticket(ctx: Context, number: Int) = call(ctx, "/tickets/$number")
    suspend fun reply(ctx: Context, number: Int, text: String) = call(ctx, "/tickets/$number/messages", "POST", JSONObject().put("text", text))
    suspend fun unread(ctx: Context) = call(ctx, "/unread").getInt("count")
}

Needs the INTERNET permission in your manifest.

Flutter (Dart)

Uses the http and shared_preferences packages.

import 'dart:convert';
import 'dart:math';
import 'package:http/http.dart' as http;
import 'package:shared_preferences/shared_preferences.dart';

class Junco {
  static const server = 'https://desk.juncodesk.app';
  static const key = 'jk_YOUR_PUBLIC_KEY';

  static Future<String> _playerId() async {
    final prefs = await SharedPreferences.getInstance();
    var id = prefs.getString('junco_player');
    if (id == null || id.length < 32) {
      final r = Random.secure();
      id = List.generate(24, (_) => r.nextInt(256).toRadixString(16).padLeft(2, '0')).join();
      await prefs.setString('junco_player', id);
    }
    return id;
  }

  /// Throws an Exception whose message you can show the user.
  static Future<Map<String, dynamic>> _call(String path, {String method = 'GET', Map<String, dynamic>? body}) async {
    final uri = Uri.parse('$server/v1/games/$key$path');
    final headers = {'X-Junco-Player': await _playerId(), if (body != null) 'Content-Type': 'application/json'};
    final res = switch (method) {
      'POST' => await http.post(uri, headers: headers, body: jsonEncode(body)),
      'DELETE' => await http.delete(uri, headers: headers),
      _ => await http.get(uri, headers: headers),
    };
    final data = res.body.isEmpty ? <String, dynamic>{} : jsonDecode(res.body) as Map<String, dynamic>;
    if (res.statusCode >= 300) throw Exception(data['error'] ?? "Couldn't reach support. Try again in a moment.");
    return data;
  }

  /// type: 'bug', 'idea' or 'help'
  static Future<Map<String, dynamic>> report(String type, String text, Map<String, dynamic> context) =>
      _call('/tickets', method: 'POST', body: {'type': type, 'text': text, 'context': context});
  static Future<List<dynamic>> tickets() async => (await _call('/tickets'))['tickets'] as List<dynamic>;
  static Future<Map<String, dynamic>> ticket(int number) => _call('/tickets/$number');
  static Future<Map<String, dynamic>> reply(int number, String text) => _call('/tickets/$number/messages', method: 'POST', body: {'text': text});
  static Future<int> unread() async => (await _call('/unread'))['count'] as int;
}

Flutter web builds run in a browser, so they send an Origin header: list the site's address on the product in Junco, or use the widget.

React Native and Expo

fetch is built in; the id uses expo-crypto and @react-native-async-storage/async-storage.

import AsyncStorage from "@react-native-async-storage/async-storage";
import * as Crypto from "expo-crypto";
import { Platform } from "react-native";

const SERVER = "https://desk.juncodesk.app";
const KEY = "jk_YOUR_PUBLIC_KEY";

async function playerId() {
  let id = await AsyncStorage.getItem("junco.player");
  if (!id || id.length < 32) {
    id = Array.from(Crypto.getRandomBytes(24), (b) => b.toString(16).padStart(2, "0")).join("");
    await AsyncStorage.setItem("junco.player", id);
  }
  return id;
}

async function call(path, { method = "GET", body } = {}) {
  const res = await fetch(`${SERVER}/v1/games/${KEY}${path}`, {
    method,
    headers: { "X-Junco-Player": await playerId(), ...(body ? { "Content-Type": "application/json" } : {}) },
    body: body ? JSON.stringify(body) : undefined,
  });
  const data = await res.json().catch(() => ({}));
  if (!res.ok) throw new Error(data.error ?? "Couldn't reach support. Try again in a moment.");
  return data;
}

export const Junco = {
  // type: "bug", "idea" or "help"
  report: (type, text, context = {}) =>
    call("/tickets", { method: "POST", body: { type, text, context: { os: `${Platform.OS} ${Platform.Version}`, ...context } } }),
  tickets: async () => (await call("/tickets")).tickets,
  ticket: (number) => call(`/tickets/${number}`),
  reply: (number, text) => call(`/tickets/${number}/messages`, { method: "POST", body: { text } }),
  unread: async () => (await call("/unread")).count,
  deleteEverything: () => call("/me", { method: "DELETE" }),
};

For a screenshot, send FormData with a ticket field (the JSON as a string) and { uri, name: "screenshot.jpg", type: "image/jpeg" } as screenshot, without setting Content-Type yourself.

Desktop apps and servers (any language)

Any HTTP client works the same way: the base address, the X-Junco-Player header (or a signed token), JSON in and out. From a terminal:

ID=$(head -c 24 /dev/urandom | base64 | tr '+/' '-_' | tr -d '=')
curl -s -X POST https://desk.juncodesk.app/v1/games/jk_YOUR_PUBLIC_KEY/tickets \
  -H "X-Junco-Player: $ID" \
  -F 'ticket={"type":"bug","text":"The export button does nothing","context":{"version":"2.1.0"}}' \
  -F '[email protected]'
curl -s https://desk.juncodesk.app/v1/games/jk_YOUR_PUBLIC_KEY/tickets -H "X-Junco-Player: $ID"

Electron and Tauri apps that load an https:// site can use the widget there; apps that load local files can't (Junco only allows https:// web addresses), so use this API from the main process, or the hosted page.

Showing replies

Users only see replies where you show them. A simple pattern:

  1. When the app starts or comes back to the front, call GET /unread and put the count on your Support button.
  2. The Support screen lists GET /tickets (newest activity first; unread marks new replies).
  3. Opening one calls GET /tickets/<number>, which marks it read. While aiWorking is true, call it again every 2 seconds (stop after about 90 seconds): the AI's reply is on its way.

Rate limits are generous for this: 300 reads a minute per address. All of them: Limits.

For AI tools: this page as Markdown at /docs/platforms.md, every guide in one file at /llms-full.txt, the API as OpenAPI. Checked against Junco on 2026-11-25.