CodeGym
AI Academy
Promotion
CodeGym University
Learning
Courses
Tasks
Surveys & Quizzes
Games
Help
Schedule
Community
Users
Forum
Chat
Articles
Success stories
Activity
Reviews
Subscriptions
Light theme

Lessons

  • Reviews
  • About us
Start
Start learning
Start learning now
  • My Progress
  • Courses
  • University
  • Quest Map
  • Lessons
  • Working in the sandbox: constraints, nuances, and window.openai

    ChatGPT Apps
    Level 3, Lesson 0
    We’ll break down how the widget sandbox in ChatGPT Apps works: why it’s not “a regular site in an iframe,” what limitations origin/sandbox/CSP impose, how to safely communicate with the host via window . openai, and why it’s better to use React hooks in the UI layer ( useWidgetProps, useWidgetState, useOpenAIGlobal) instead of poking the global object directly. We’ll also discuss the boundaries of responsibility among “widget ↔ ChatGPT ↔ MCP/server,” state storage, and common mistakes.
    Available
  • Controlling appearance: displayMode, maxHeight, borders, theme, layout

    ChatGPT Apps
    Level 3, Lesson 1
    In this lecture we break down how to “fit” your ChatGPT App UI into chat constraints: how to read and switch displayMode (inline/fullscreen/PiP), respect the maxHeight limit without “double scroll,” sync height via notifyIntrinsicHeight (), adapt the look to the theme, and build a resilient layout for desktop/mobile.
    Available
  • State management — Widget State, ToolInput, ToolOutput

    ChatGPT Apps
    Level 3, Lesson 2
    In this lecture, we’ll break down the state map in ChatGPT Apps and hands-on practices: where to keep authoritative business data (via MCP and toolOutput), where to keep ephemeral UI (local React useState), and where you need durable state at the message level ( widgetState via useWidgetState). We’ll also discuss tool input ( toolInput), metadata ( toolResponseMetadata / _meta), “loading / empty / error” patterns, wizard steps, and common pitfalls.
    Available
  • Interacting with ChatGPT: follow-ups and “dialogs around the widget”

    ChatGPT Apps
    Level 3, Lesson 3
    We’ll break down what a follow-up is in the ChatGPT App, how a click in a widget turns into a new user message, why it’s usually better to send text via useSendMessage/ sendFollowUpMessage rather than calling a tool directly, how the “conversational sandwich” works (pre-text → widget → post-interaction), and how to synchronize widgetState with the chat history. Finally, we’ll cover principles for designing good follow-ups and common pitfalls.
    Available
  • Interacting with the server: window.fetch and openExternal

    ChatGPT Apps
    Level 3, Lesson 4
    How a “sandboxed widget” talks to the outside world in ChatGPT Apps: safe navigation via openExternal (and the useOpenExternal hook instead of window. open), limitations and pitfalls of window. fetch, why relative paths like "/api/..." break inside the host, and how this leads to a “thin UI—thick backend” architecture with a focus on MCP/ callTool.
    Available
Learn
  • Registration
  • Java Course
  • Help with Tasks
  • Pricing
  • Java Syntax
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success Stories
  • Activity
  • Affiliate Program
Company
  • About us
  • Contacts
  • Reviews
  • Press Room
  • CodeGym for EDU
  • FAQ
  • Support
CodeGym CodeGym is an online course for learning Java programming from scratch. This course is a perfect way to master Java for beginners. It contains 1200+ tasks with instant verification and an essential scope of Java fundamentals theory. To help you succeed in education, we’ve implemented a set of motivational features: quizzes, coding projects, content about efficient learning, and a Java developer’s career.
Follow us
Interface language
English
Deutsch Español हिन्दी Français Português Polski বাংলা 简体中文 मराठी தமிழ் Italiano Bahasa Indonesia 繁體中文 Nederlands 日本語 한국어 Bulgarian Danish Hungarian Basa Jawa Malay Norwegian Romanian Swedish Telugu Thai Українська Filipino Turkish Azərbaycan Русский Vietnamese
Programmers Are Made, Not Born © 2026 CodeGym
MastercardVisa
Programmers Are Made, Not Born © 2026 CodeGym