VOOZH about

URL: https://www.digitalocean.com/community/tutorials/custom-realtime-chat-application

⇱ Building a Custom Real-time Chat Experience with DigitalOcean's Gradient Platform | DigitalOcean


Building a Custom Real-time Chat Experience with DigitalOcean's Gradient Platform

Published on January 29, 2025

By Wade Wegner

Chief Ecosystem and Growth Officer

👁 Building a Custom Real-time Chat Experience with DigitalOcean's Gradient Platform

Introduction

Imagine building a ChatGPT-like experience that you can fully customize to your needs. With DigitalOcean’s new Gradient Platform, which just launched into Public Preview at this year’s Deploy conference, you can do exactly that.

What’s particularly exciting about the Gradient Platform is its flexibility. For many use cases, you don’t need to write any code at all – you can simply grab a JavaScript snippet from the DigitalOcean Control Panel and embed a chatbot directly into your application. But as a developer, what really excites me is the ability to use the APIs to build any kind of experience I want.

In this post, I’ll walk through building a custom chat application that mimics the ChatGPT experience. This example will teach you three key components of building a robust chat application:

  1. API Authentication - Securely connecting to the Gradient Platform
  2. Real-time Communication with WebSockets - Setting up bi-directional communication
  3. Chat Service and Message Processing - Managing conversations and streaming responses

The best part is that once you understand all the pieces, you can customize it to work the way you want.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the author

👁 Wade Wegner
Wade Wegner
Author
Chief Ecosystem and Growth Officer
See author profile

Chief Ecosystem and Growth Officer at DigitalOcean. Ultrarunner, adventure seeker, tragic optimist.

Still looking for an answer?

Was this helpful?

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Tried setting this up and could not get it to work. We get a “pong” back from the API, so we know that’s working. But, when we tried to send a message to the chat application we always get this error: 'Error: Failed to send message to AI: Failed to get refresh token: Request failed with status code 401\n' + ' at ChatService.sendMessage (do-genai-customchatbot\\services\\chatService.js:189:13)\n' + ' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' + ' at async do-genai-customchatbot\\routes\\chat.js:27:20

I assume this is because we are missing some correct value in the ENV, but unfortunately, there is no guidance as to what the ENV values should actually be. What is the API_BASE? Where do we get this? What is the SESSION_SECRET? Where do we get this. AGENT_ENDPOINT? AGENT_ID? There is no explanation on where to find these values in the dashboard. Please provide screenshots and an explanation for where to find the values that are needed in the ENV. Thanks.

👁 Creative Commons
This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License.
  • Deploy on DigitalOcean

    Click below to sign up for DigitalOcean's virtual machines, Databases, and AIML products.

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and AI-native businesses

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

© 2026 DigitalOcean, LLC.Sitemap.
Dark mode is coming soon.