If I had a dollar for every question I’ve seen about doing this from scratch – and then never heard a thing from the person again – then I’d already be rich. Either people never finish these projects, or they keep them close to the chest once completed.
Basically, there are two ways to approach this. Write it from scratch, or use the building blocks already available. Building blocks include free, open source components, for instance on GitHub, or commercial APIs. ProgrammableWeb and Mashape are good places to start researching APIs.
I can tell you right now that people have trouble “recognizing the meaning of text you input”, and there are no machines today that can do this better than people. The history of the Turing Test, in the form of the Loebner Prize, has shown that a huge amount of mind games, smoke and mirrors, basically theatrics are required for convincing human dialog.
See also my Quora answers to: