You could look at this sample in the marketplace. There are other alternatives as well (google/aws/etc), so depending on your requirements, I would advise you to browse for 'chat bot' or the required technology in the market place and make use of the samples to understand what is required.