Humor makes interactions go more easily. Introducing a little fun to a chatbot can make it more appealing to customers. It does require a bit of caution; what's funny to one person may be offensive to another. Chatbots work best when they seem a bit human, though. With the right touch, humor can create a better user experience.
It's rarely appropriate for a bot to just start joking. The best time for humor is when the user initiates it. Star Trek fans, echoing an instruction by Captain Kirk in one episode, sometimes ask Alexa to "compute pi to the last digit." This is mathematically impossible, but Alexa has a variety of appropriately silly responses.
The key is to respond to the user's intent. Some users try odd questions just to test a chatbot's limits. Responding humorously should satisfy their mood. On the other hand, offering jokes when the user is trying to get a serious answer can quickly result in a former user.
How much humor to use depends on the bot's purpose. If it's an entertainment bot, you can go all out. If it's an emergency response system, cut it completely. In between, a conservative use of humor can work.
Related: Why Chatbots Need Quality Standards?
Cleverbot is one of the better-known bots whose purpose is to have fun. Its response to computing pi is a bit dull: "That's impossible, pi is infinite." If you try to get into an argument with it, it responds with non sequiturs. It's amusing for a little while but gets dull.
The lesson to learn from Cleverbot is not to overdo the humor. It's a seasoning and doesn't go well as the main course. Adding a bit of humor when it's appropriate to the bot's purpose can work. Siri offers responses like "I can't download things for you. I'm sorry. I feel terrible about this." That works. Incorporating humor is an area where a lot of judgment is involved.