Created
April 25, 2022 15:42
-
-
Save ademilter/975343a47bce6a4e586b7cde46b946ae to your computer and use it in GitHub Desktop.
@upstash/chatbox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pages/api/chatbox/[...chatbox].js | |
import createChatBoxAPI from "@upstash/chatbox/api"; | |
const ChatBoxAPI = createChatBoxAPI({ | |
webhooks: [process.env.SLACK_WEBHOOK_URL!], | |
}); | |
export default ChatBoxAPI; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pages/_app.jsx | |
import "@upstash/chatbox/index.css"; | |
import { AppProps } from "next/app"; | |
import dynamic from "next/dynamic"; | |
const ChatBoxWidget = dynamic({ | |
loader: () => import("@upstash/chatbox").then((mod) => mod.ChatBoxWidget), | |
ssr: false, | |
}); | |
export default function App(props: AppProps) { | |
const { Component, pageProps } = props; | |
return ( | |
<> | |
<ChatBoxWidget /> | |
<Component {...pageProps} /> | |
</> | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pages/chat/[id].jsx | |
import dynamic from "next/dynamic"; | |
const ChatBoxAdmin = dynamic({ | |
loader: () => import("@upstash/chatbox").then((mod) => mod.ChatBoxAdmin), | |
ssr: false, | |
}); | |
export default function () { | |
return <ChatBoxAdmin />; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment