ELIZA was one of the first chatbot programs, created at MIT in 1966. It simulated a Rogerian psychotherapist by pattern matching and substitution, and is a landmark in the history of AI.
Build your own ELIZA Chatbot is available with a project breakdown on Coding Challenges.