Share product ideas and upvotes with our product team
Integrating artificial intelligence into web apps can help build dynamic and engaging user experiences. When we take full advantage of large language models from platforms such as OpenAI, developers can build smart AI apps that generate text, auto-summarize content, and even answer questions. The AI software market will reach a valuation of USD 12.6 billion by the year 2028. We have formed a detailed walkthrough with a step-by-step Next.js OpenAI API tutorial integration.Why Next.js and OpenAI Are a Perfect MatchNext.js is a powerful React framework that excels at building production-ready applications. It comes with several promising features, including server-side rendering (SSR) and API routes. This makes it an ideal environment for interacting with external APIs, such as OpenAI. We utilize Next.js API routes to store sensitive API keys on the server. Hire Next.js developers who take this server-side approach to build complex, data-driven, smart applications.OpenAI’s API provides programmatic access to its ecosystem of powerful models. Combining the secure architecture provided by Next.js with the advanced AI capabilities of the OpenAI API enables people to build intelligent, AI-based applications. If your project requires this level of expertise and you need a dedicated team to help, you may want to consider professional frontend development services or hire Next js developer to bring your vision to life.Step-by-Step Guide to Setting Up Next.js Open AI IntegrationStep 1: Project Setup and DependenciesStart by setting up a new Next.js project. Install all the needed libraries, and use the official OpenAI Node.js package for making API calls. For an advanced app experience, especially for chat applications, you can also integrate Intercom with ChatGPT to enhance user support and engagement. Additionally, consider using the Vercel AI SDK to streamline the interface for various AI services.In your terminal, navigate to your project directory and run the following command:npm install openai ai @ai-sdk/react @ai-sdk/openaiopenai: The official SDK for interacting with the OpenAI API. ai: The core AI SDK from Vercel. @ai-sdk/react: React-specific hooks for the AI SDK, like useChat, which simplifies building chat UIs with streaming responses. @ai-sdk/openai: An adapter that makes the OpenAI API compatible with the AI SDK.Step 2: Securing Your OpenAI API KeySecurity is paramount. You must never expose your OpenAI API key on the client side. The best practice is to store it as an environment variable on your server.In the root of your project, create a file named .env.local and add your API key:OPENAI_API_KEY=your_openai_api_key_hereReplace your_openai_api_key_here with your actual key. Next.js automatically loads these variables at runtime. Remember to restart your development server (npm run dev) if you add or change this file.Step 3: Setting Up Next.js API RoutesAPI routes are the secure backbone of our application. They act as a serverless function that handles requests from the frontend, communicates with the OpenAI API, and sends back the response. This prevents your API key from ever reaching the user's browser.If you're using the App Router, which is the modern standard for Next.js, create a file at app/api/chat/route.ts. This file will handle POST requests from the frontend.app/api/chat/route.tsTypeScriptimport OpenAI from 'openai';import { OpenAIStream, StreamingTextResponse } from 'ai';const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY,});export async function POST(req: Request) { const { messages } = await req.json(); const response = await openai.chat.completions.create({ model: 'gpt-4o', // Or a different model like 'gpt-3.5-turbo' stream: true, messages: messages, }); const stream = OpenAIStream(response); return new StreamingTextResponse(stream);}This code snippet highlights a few key points:Security: It uses process.env.OPENAI_API_KEY, which is only available on the server. Streaming: The stream: true option tells OpenAI to send the response in chunks as it's being generated. The Vercel AI SDK's OpenAIStream then formats this into a stream the frontend can easily consume. This is a game-changer for perceived performance.Step 4: Building the FrontendNow for the client-side you should opt for reliable frontend development services. We will make a simple user interface that sends user input to our API route and displays the AI's response. The Vercel AI SDK's useChat hook makes this remarkably easy, handling all the state management and streamlining the logic for us.In your app directory, let's create a component.app/page.tsxTypeScript'use client';import { useChat } from 'ai/react';import { FormEvent } from 'react';export default function ChatComponent() { const { messages, input, handleInputChange, handleSubmit } = useChat(); return ( <div className="flex flex-col h-screen p-8 bg-gray-100 text-gray-800"> <h1 className="text-3xl font-bold mb-4 text-center text-blue-600">AI Chatbot</h1> <div className="flex-1 overflow-y-auto mb-4 p-4 border border-gray-300 rounded-lg bg-white shadow-inner"> {messages.map((m) => ( <div key={m.id} className={`mb-2 p-2 rounded-lg max-w-lg ${m.role === 'user' ? 'bg-blue-200 self-end text-right' : 'bg-gray-200'}`}> <p className="font-semibold">{m.role === 'user' ? 'You:' : 'AI:'}</p> <p className="whitespace-pre-wrap">{m.content}</p> </div> ))} </div> <form onSubmit={handleSubmit as (e: FormEvent<HTMLFormElement>) => void} className="flex space-x-2"> <input className="flex-1 p-3 border border-gray-400 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500" value={input} onChange={handleInputChange} placeholder="Say something to the AI..." /> <button type="submit" className="p-3 bg-blue-600 text-white rounded-lg font-bold hover:bg-blue-700 transition duration-300" > Send </button> </form> </div> );}The frontend is simple. Thanks to the useChat hook. You don’t have to manage all the background tasks. It provides ease of managing access, history, user input, and streams responses from the AI as they arrive. The UI updates in real time, so everything feels smooth and responsive as you chat.Best Practices and Further ConsiderationsError HandlingThings won’t always go smoothly, so it's important to plan for errors. Ensure your app can identify and respond to issues such as failed API requests or invalid inputs with helpful, easy-to-understand messages, rather than displaying technical errors or blank screens.Rate LimitingIf your app is live and being used regularly, you’ll want to put some limits in place to prevent users from making multiple requests too quickly. This helps protect your system and limits you from exceeding your API quota too quickly.Choosing the Right ModelNot all tasks require you to use the most powerful model. GPT-4o has high potential, but it is more expensive. If you are performing a basic task, such as text summarization or Q&A, gpt-3.5-turbo may be all you need.Final WordsBy following this Next.js OpenAI integration tutorial, you can easily add the OpenAI API to a Next.js application. Using API routes and the Vercel AI SDK, you can mention a secure, efficient, and user-friendly way to integrate the power of AI into your projects. This foundation offers a range of applications, including a Next.js AI app and content generation tools. The OpenAI API is a powerful tool, and combined with Next.js, it allows you to build intelligent web applications that truly stand out.
It would be super useful if there is an autosave feature as we are typing in the reply or writing a note. Currently we can start writing a note, move to work on another ticket and come back to pick up where we left off. However, all the content of the note/reply would be lost if we experience sudden power outage or if we logged out. This would increase efficiency since some replies take some time and additional research to come back to.
Currently all attachments appear at the bottom, which are often missed by clients, as they are used to seeing these appear at the top, right below subject header line. Can we have this changed, so that the attachments aren’t crowding the email signatures/banners at the bottom of the email.
This request is to add an integration with Monday.com so that documents can be synced as internal or external articles to the Intercom Help Center.Use case:Companies that primarily use Monday.com for documentation and collaboration between internal teams, but want this documentation synced into Intercom to either display as external articles and used by FinAI or to simply be accessible to Copilot through Internal articles.
Right now the outbound caller ID is set to our main number we have through Intercom. Currently we forward all our 800 number and advertised local number to it so we did not need to port any numbers over. I would like to set that Outbound caller ID to our 800 number so they see a familiar number show up.This is a big deal as right now people think we are SPAM callers since they don’t recognize the number.
Allthough we have configured that email history should be sent along in emails to users, we notice that this is rarely the case. The answer for the Support team we got was that the history that is sent are only messages that have not yet been seen by the user.We would like to have the option to send emails to customers that include the complete public comments from a ticket. The advantage of this is that our users are always informed which ticket the communication concerns.
Currently, all internal Notes in a Conversation are yellow, making it difficult to highlight the most important urgent pieces of an interaction for our agents to take note of in a thread. The ability to choose a different color background to draw attention to critical information in a conversation thread would be a welcome improvement.
The ability to color code current messages/tickets in our inbox based on the status would be helpful. Additionally, the ability to add a note to myself on the status of the ticket/message. Increased tools for inbox management as a whole.
When a conversation is unassigned and an agent starts typing their response, if at the moment of sending the response the conversation was assigned to someone else (most likely because they also answered or have clearly specified they would), a confirmation would be displayed saying "Are you sure you want to send this response? This conversation was assigned to someone else since you started answering".This could be generalized to any reassignment since started typing, with a warning saying “This conversation was assigned to {name} since you started typing your answer. Are you sure you want to send this message?”.Or similar, you get the idea… 😉
Hi there,We’ve had multiple customers raise the issue that they can’t easily search their historic tickets in Messenger. Right now, end-customers can only scroll through the tickets they’ve submitted, but there’s no way to filter or search by: Ticket ID Order number / tracking number Keywords in the ticket subject or content This creates a lot of friction for brands with high ticket volumes, since customers have to scroll endlessly to find the right ticket.What we’re asking for: A native search bar in the Messenger Tickets tab (or Customer Portal) that lets customers quickly find previous tickets by ticket ID or keyword. Ideally, ability to filter tickets by status (e.g. pending, resolved). Why it matters: Improves self-service and reduces inbound requests like “Can you resend me the status of my ticket?” Makes Messenger more usable for enterprise/scale-up customers. Multiple brands are asking for this functionality. Current workarounds: Manually tagging tickets with order numbers so customers can scan visually. Exploring custom API builds to add a search widget but a native solution would be far more reliable and scalable.
Just like you can with data connectors and mapping fields, I would like to do the same in converting the workflow path to a ticket.
We have multiple stores and will need multiple guidances set for each store. Currently, I’m differentiating them by their name. For example: [FL] Cancelation policy and [CA] Cancelation policy. While this categorization works for me, I would really like having an option to drag and move guidances so I could have them organized by store. Currently, it’s a bit of a mess since they are listed from oldest to newest.
Hi, I have some tickets in my inbox that sits there because I need to do a review on how Fin handled them, hoever they a bloating my inbox while they are in this state. Would be awesome to “Save for AI review” or something, to remove them from my table and have them saved for later.
Regarding the Jira Cloud integration - when creating a ticket from the Intercom conversation, this is done on the right side bar labeled Details.The information is submitted directly from there.These tickets can be very detailed and require quite a bit of information at times.My team would like the ability to “pop out” this section into a full screen mode where there is more room to edit and expand the boxes.Request to add a full screen option for Jira Cloud ticket entry (could be much like when a conversation opens on a side bar and there is an option to maximize the conversation into a full screen/new tab).Thank you!
I am aware of the option to see the list in the little chat window, but it is not searchable. If i want to see what the answer was to my question X that was closed a few months ago, I can find it again.
Hi team,I hope you’re doing well.Currently, the description which is added to the articles have a character limit of 140 characters, however, ideal length of Meta description should be 155-160 character for SEO optimization and article ranking on the search engine.As we are planning a complete SEO revamp of our Trackier and Apptrove helpcenter, it would be great if the limit could be extended to 160 characters atleast.Thank you!
Feature Request: "Assign to Creator" Option in Workflows for ticketsCurrent Challenge:When setting up ticket assignment workflows, there's no built-in option to automatically assign tickets to the teammate who created them. Currently, you need to create separate workflows for each teammate who might create tickets, which is time-consuming and inefficient.Proposed Solution:Add an "Assign to Creator" option in the Workflow assignment actions, similar to the existing "Assign to Owner" option. This would automatically assign any ticket to whichever teammate created it, regardless of who that teammate is.Benefits:Streamlines workflow setup by eliminating the need for multiple teammate-specific rules Ensures accountability by keeping creators responsible for their tickets Reduces administrative overhead in workflow management Improves efficiency for teams where ticket creators should handle follow-upThis would be particularly valuable for internal ticketing processes where the person identifying an issue should own its resolution.
At the moment, if I create a draft of a message, I don’t think there is a central place I can go to to see all my drafts. I use drafts in Gmail, for example, as a way hold messages I plan to send and then send them when I have all the information I need. So, it would be great if there was a “drafts” tab on the left that let me see all my email drafts.
Already have an account? Login
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.