Schmavery / facebook-chat-api

Unofficial Facebook Chat API for Nodejs
MIT License
1.93k stars 597 forks source link

creating a simple ai bot #455

Closed radioactive0238 closed 7 years ago

radioactive0238 commented 7 years ago

how can i create a simple messenger bot which can understand user's message ( intents and entities) and executes functions according to them . Can anyone suggest a module to build and use a dictionary for the bot .

danielriddell21 commented 7 years ago

Look into Markov chains or Cleverbot

ravkr commented 7 years ago

This "issue" have a little to do with facebook-chat-api And making AI is not an easy task, you can make it semi-AI by just checking if some words are in the string: User sends: Who is Beethoven? Bot: I've found "who is", probably next words are name of someone, let's look on Wikipedia/google And after few seconds bot responses with some info scraped from Google

Etc...

danielriddell21 commented 7 years ago

If you want a ai bot. You need to work with neural networks so have fun

radioactive0238 commented 7 years ago

what i want to do is execute queries on elasticsearch based on the question asked by the user . what will be the simplest way to do that ? i'm trying to use api.ai with it , is it a good option ?

danielriddell21 commented 7 years ago

You are very unlikely able to integrate this api and api.ai together. Your best bet is to code it yourself.

danielriddell21 commented 7 years ago

with if statements just check if the message.body has the question and then from that you can use api.sendMessage...

Schmavery commented 7 years ago

You can do pretty much wherever you want. You have a listen callback that tells you what people are saying to you, and you've got sendMessage which will let you send a message to a person. The rest should just be programming 😝 I'm going to close this issue because it doesn't seem like there's an issue with the api, but feel free to keep chatting.

kabirvirji commented 7 years ago

Sounds like you're looking for something like https://wit.ai/ or https://api.ai/

radioactive0238 commented 7 years ago

one more help , i want to send buttons as a message . the template will be sent as an attachment but when i try to send , it shows error that attachment should be a readable stream . what am i doing wrong ??

gamelaster commented 7 years ago

Buttons? It's not supported by normal user

Schmavery commented 7 years ago

@radioactive0238 it seems like you're trying to make a bot using the official chatbot api -- this is not the api for that. Maybe check out https://developers.facebook.com/docs/messenger-platform and some of the other links people have posted :)

radioactive0238 commented 7 years ago

thank you everyone for your help . i'll check the official chatbot api .