Menu

Chat SDK adds web adapter support - Vercel
📰

Chat SDK adds web adapter support - Vercel

Vercel News·Ben Sabic·5 months ago
#92LLYmrX
#vercel#chat#adapter#build#import
Reading 0:00
15s threshold

You can now build chat UIs that connect to Chat SDK with the new web adapter . Build in-product assistants, support agents, or any other browser-based chat experience.

Define the bot on your server:

import { Chat } from "chat" ;

import { createWebAdapter } from "@chat-adapter/web" ;

const bot = new Chat ( {

userName : "mybot" ,

adapters : {

web : createWebAdapter ( {

userName : "mybot" ,

getUser : ( req ) => ( { id : getUserIdFromCookie ( req ) } ) ,

} ) ,

} ,

} ) ;

bot . onDirectMessage ( async ( thread , message ) => {

await thread . post ( ` You said: ${ message .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.