How To Create Simsimi Bot On Facebook Messenger

How to Create SimSimi bot on Facebook Messenger 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 -v
If 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 init
Then 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 index

The 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 axios

After installing axios, we modify the code in the index.js file as follows:
const login = require("facebook-chat-api");
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);
      } )

    });
});
The code above will listen to your incoming message, send the request to Simsimi Api and retrieve the response to reply.

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


Related Posts

0 Response to "How To Create Simsimi Bot On Facebook Messenger"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel