This guide assumes that you have completed the Quickstart.
generateShareLink(message) function that calls your backend and returns a URL. The SDK handles the modal UI, copying, and confirmation.
1
Frontend: Add a Share button to the response footer
Create a footer component using the pre-built Then pass it to
ResponseFooter.ShareButton.Footer.tsx
C1Chat:App.tsx
2
Frontend: Add a component to render the shared message
Create a route and component on the frontend to render the shared message:
/app/shared/[threadId]/[messageId]/page.tsx
3
Backend: Implement the message share endpoint
Implement an endpoint that returns the message for a given
threadId and messageId.Implement a message store to store the message history. If you’ve followed the Quickstart, you’ll have a message store already, which you can move
to a common location (such as
/lib/messageStore.ts) and modify it to persist message history across API routes and requests as follows:/lib/messageStore.ts
/app/api/share/[threadId]/[messageId]/route.ts
4
Test it out!
- Send a message and wait for the assistant response.
- Click the share button in the footer.
- Generate and copy the link from the modal.