Skip to content

vdthatte/How-To-Build-Chatbot-2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

How To Build Chatbot - Part 2

Part two of How To Build a Chatbot on Facebook

Install Wit Ai using this Link

from wit import Wit
def send(request, response):
    print('Sending to user...', response['text'])
def my_action(request):
    print('Received from user...', request['text'])

actions = {
    'send': send,
    'my_action': my_action,
}



client = Wit(access_token="YOUR_CLIENT_ACCESS_TOKEN", actions=actions)
def wit_bit(message_text, sender_id):
	resp = client.message(message_text)

	if(resp["entities"] != {}):
		if(resp["entities"]["intent"][0]["value"] == "greetings"):
			print("Hey! How can I help you?")
			send_message(sender_id, "Hey! How can I help you?")

		else:
			print("I'm to dumb to understand complex sentences.")
			send_message(sender_id, "I'm dumb sometimes. Maybe start by saying Hello?")
	else:
		print("I'm to dumb to understand complex sentences.")
		send_message(sender_id, "I'm dumb sometimes. Maybe start by saying Hello?")

About

Part two of How To Build a Chatbot on Facebook

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published