How To Create Simsimi Bot On Facebook Messenger
How to Create SimSimi bot on Facebook Messenger - Hello, you guys are no stranger to the SimSimi chicken with answers he thirst was hot isu terkini a few years ago. Today we will turn your facebook messenger "cosplay" into this Simi bot
TOOLS FOR USE:
- Set point
- Facebook Chat Api
- Axios
- Simsimi Fire
- A facebook account clone to test
First you need to install NODEJS, if you do not know how to install then you learn at this link:
https://nodejs.org/en/download/package-manager/ After downloading nodejs successfully you go to cmd or terminal.
Type command :
node -vIf your current version as shown is ok then that.
Next we create a new folder and then create the project in that folder.
In the new folder you open the terminal or cmd and then type:
npm initThen enter the information or hit enter to create the project by default.
Next, you need to install the Facebook Chat Api package, continue to type the command:
npm install facebook-chat-api
Wait for a while to install the package offline.
After successful installation will be notice as shown below.
Next you create a file named index.js and then enter the following code into:
const login = require("facebook-chat-api");
// Create simple echo bot
login({email: "FB_EMAIL", password: "FB_PASSWORD"}, (err, api) => {
if(err) return console.error(err);
api.listen((err, message) => {
api.sendMessage(message.body, message.threadID);
});
});
In FB_EMAIL and FP_PASSWORD you enter your email and password.
Open the terminal
type :
node indexThe code above will create a chatbot server automatically reply to the message identical to the message it received. If the terminal running as shown below is the server running it. Now we use facebook clone to message for yourself :))
Good, now continue to assign the soul of the chicken to SimSimi for him.
Now we will use the Axios package to send the request to the Simsimi api:
type :
npm i axiosAfter installing axios, we modify the code in the index.js file as follows:
const login = require("facebook-chat-api");The code above will listen to your incoming message, send the request to Simsimi Api and retrieve the response to reply.
const axios = require("axios");
// Create simple echo bot
login({email: "FB_EMAIL", password: "FB_PASSWORD"}, (err, api) => {
if(err) return console.error(err);
api.listen((err, message) => {
axios.get('http://api.minhhieu.asia',{params:{text:message.body}})
.then( response =>{
api.sendMessage(response.data, message.threadID);
} )
});
});
We ran the server:
type :
node index
If the server runs fine, without any error then we have succeeded. Then we go to facebook clone message for the main nick and enjoy the results only :))
Api is currently working only English support, in the next time I will do more Vietnamese.
Thank you for watching.
Next time we will learn the mechanism of Facebook Chat Api and together do auto tool swearing
0 Response to "How To Create Simsimi Bot On Facebook Messenger"
Post a Comment