useCreateMessage

Use the useCreateMessage hook to create a thread message.
app.tsx
import { useCreateMessage, } from '@superinterface/react' export const App = () => { const { createMessage, isPending } = useCreateMessage() return ( <button onClick={()=> ( !isPending && createMessage({ content: 'Hello AI!' }) )} > Send a message </button> ) }

Arguments

No parameters available.
To set mutation options, use defaultOptions from <SuperinterfaceProvider> or <Thread.Root>.

Returns

Here's a summary of useMessages return properties:
PropType
createMessageFunction
Good to know:
useCreateMessage additionally returns all props from Tanstack Query useMutation. So you can use props like isPending, data and so on.
createMessage function is actually equivalent to mutateAsync function from Tanstack Query useMutation.