With Facebook’s introduction of bots on Messenger last month, chatbots, which have been around for decades, have suddenly taken the leap from fun toy project to cutting-edge business proposition. With this rapid rise to prominence, it’s critical to differentiate the hype from the true value bots can offer when you consider using one for your business.

Here are some best practices to make sure your chatbot development project succeeds and doesn’t turn into another Tay, the short-lived, bigoted A.I.-powered bot we came to know and fear.

1. Set clear goals

Since there are real costs to developing a chatbot, have a clear idea of what you hope to get out of the endeavor. Is it an opportunity to drive new sales? To learn from your existing customers? To streamline internal processes? Before jumping in, have clear ideas about who will be developing, testing and maintaining the chatbot as well as the value you hope to get from the project.

A chatbot is an IT project. It requires developers and testers. It should be integrated into your larger information infrastructure and maintained. As your product lists and goals change, you’ll need to update your chatbot too.

2. Find the right use cases

Some customer interactions are better served by a chatbot than others. If there are many specific choices a customer needs to make, you might be better off using a simple web form interface. If a process is high value and very personalized, like a sales pitch, you may want to keep a human in the loop.

So where do chatbots work best? They can listen to a customer’s needs and help filter through a long list of choices, prompting the user for relevant information as required. They can use a customer’s stated goal to perform more accurate search. They can inject whimsy into a process. And they can gather targeted feedback during an interaction.

Consider a hybrid approach. If an existing shopping experience is working, you might include a helpful bot to answer questions off to the side and let the user navigate your inventory as they currently do.

3. Connect to existing systems

A chatbot needs to know about your business, and it needs to communicate what it learns to the appropriate employees. The worst way to accomplish that is to expect everyone to come to the bot. Don’t give your chatbot an explicit product list that’s certain to continually fall out of date. Connect it to your existing product database. Don’t tell the sales team to log into a chatbot administration console to see what leads have come in. Export those directly to the existing sales management tools in use at your business. A well designed chatbot should fit naturally into your business setting like a new employee.

4. Plan for failure

Humans will invariably ask questions you didn’t predict during design. Even the fanciest machine learning models powering your bot will make mistakes. Build expectations of failure into your bot. A user should always have an easy method to restart a conversation or back up to a previous stage. If the bot gets confused, it should fail gracefully. Politely ask the user to state what they’re trying to accomplish. Sometimes a clearer explanation can get the bot back on track. If not, log the user’s goal and add new branches to the chatbot later to deal with this case. If you can reliably catch the tasks that a user failed to accomplish, you’ll have the data to make the most impactful updates next time you upgrade the bot.

5. Pay attention to tone

Your chatbot is a face of your organization and an opportunity to delight or enrage existing and prospective customers. Just like an employee will tailor their language to a customer’s tone, a chatbot needs to be aware of the reactions it is eliciting. Simply conveying concern and understanding towards a frustrating situation can go a long way towards alleviating hostilities. If a customer is praising your products or company, conveying happiness and gratitude will help cement the goodwill.

Sentiment analysis is a powerful tool for determining the emotional content of a message and a useful marker for controlling the flow of a conversation. Also, be ever vigilant for requests to speak with a human. Even if you have to take an email address and promise to get back to them, if the bot is not fulfilling a prospect’s needs, make sure you give them some human attention rather than leave them to turn to a competitor.

6. Listen!

A chatbot isn’t just a new medium for conveying information to customers. It’s a new opportunity to learn from the wider world. How is your brand being perceived? Which products are causing issues? What features in your products are driving sales? What concerns do customers have about your company? And how does that correlate with geography or gender or customer loyalty or any other variable you might be able to measure?

Does your sales staff have questions it would like answered by prospects? Does development want to float a feature idea to the wider market? Is marketing concerned with whether a particular message is being picked up? A chatbot gives you a natural place to just ask. A chatbot is an opportunity to learn from anyone who will talk to it, both through targeted and open-ended questions. If you’ve got existing business intelligence capabilities, the transcripts of chatbot conversations are a valuable source of additional insight. If you don’t, a chatbot is a great place to start!

Mauricio Padilla is president of Lexalytics. He has over seven years experience in enterprise software sales, professional services, project management, and consulting.