As a Facebook developer “Turn Facebook messenger into a horoscope lookup bot

Tram Ho

Introduce

In a society where houses, people, from small children to the elderly, from rural to urban, they use social networks. Especially the thing that most people use is facebook. So what is facebook or how to play facebook, I will not mention it in this article, hey! With me as a programmer today, here I will guide you to play Facebook in a cool, real way.

My product made today is: Turn your personal messenger on facebook into a versatile bot.

Demo

Begin

I think it’s a Python code guy so in this article, I would like to use Python to dance ax through the eyes of workers.

  • Preparation: Những thứ chuẩn bị ở đây anh/em code python chắc chắn biết cài rồi nên mình chỉ liệt kê mà không hưóng dẫn nữa nhé
    • Python 3.6
    • Installing fbchat libraries and requests:

    • Create a folder project : Sure, when the code we need to throw code into a folder here, I name the folder nguyenmanh_messenger_bot .
    • Create main.py file: * This is the file I will code the main program in here =)) nói những thứ thừa thãi v**
    • Create file tu_vi.py : Used to code things related to the horoscope API
    • Create session.json file: Use to save the facebook session
    • Create file nguyen_manh_bot.py : Used to code bot messenger alt text
  • List of APIs used in the article:
    • Horoscope of the zodiac daily: https://api.kma-chatbot.com/cunghoangdao.php?cung=<Tên cung hoàng đạo>
      • Example zodiac: Pisces
    • Horoscope 12 animals daily: https://api.kma-chatbot.com/tuvi.php?tuoi=<con giáp>
      • Armor example: Ox

Deploy code

  • Code tu_vi.py :

  • Code nguyen_manh_bot.py

  • Code main.py

Put code on heroku

Render JSON, which library is good?
Japan: Code will become compulsory subject from 5th grade by 2020

Now you have a pretty ok bot, you can run it locally, but to be more professional, we should put it on heroku so that it doesn’t have to turn on it to listen forever =))

Follow the steps below to put the code up

  • Login to heroku

  • Initialize git

  • Add remote of heroku to git Thay nguyen-manh-messenger with the app name you created on heroku

  • Your Deploy app

Result

Automatically reply to smart and funny messages via facebook messenger using Node.js and Simsimi
MESSENGER MARKETING & CHATBOT – New door for digital marketing
Share the news now

Source : viblo .uebcb1047c8ba3c286674517413df393c { padding:0px; margin: 0; padding-top:1em!important; padding-bottom:1em!important; width:100%; display: block; font-weight:bold; background-color:#eaeaea; border:0!important; border-left:4px solid #34495E!important; text-decoration:none; } .uebcb1047c8ba3c286674517413df393c:active, .uebcb1047c8ba3c286674517413df393c:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; text-decoration:none; } .uebcb1047c8ba3c286674517413df393c { transition: background-color 250ms; webkit-transition: background-color 250ms; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; } .uebcb1047c8ba3c286674517413df393c .ctaText { font-weight:bold; color:inherit; text-decoration:none; font-size: 16px; } .uebcb1047c8ba3c286674517413df393c .postTitle { color:#000000; text-decoration: underline!important; font-size: 16px; } .uebcb1047c8ba3c286674517413df393c:hover .postTitle { text-decoration: underline!important; } Tự động trả lời tin nhắn thông minh và hài hước qua facebook messenger sử dụng Node.js và Simsimi .ucec3ce14c33a0d1e64f5f9d56673c829 { padding:0px; margin: 0; padding-top:1em!important; padding-bottom:1em!important; width:100%; display: block; font-weight:bold; background-color:#eaeaea; border:0!important; border-left:4px solid #34495E!important; text-decoration:none; } .ucec3ce14c33a0d1e64f5f9d56673c829:active, .ucec3ce14c33a0d1e64f5f9d56673c829:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; text-decoration:none; } .ucec3ce14c33a0d1e64f5f9d56673c829 { transition: background-color 250ms; webkit-transition: background-color 250ms; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; } .ucec3ce14c33a0d1e64f5f9d56673c829 .ctaText { font-weight:bold; color:inherit; text-decoration:none; font-size: 16px; } .ucec3ce14c33a0d1e64f5f9d56673c829 .postTitle { color:#000000; text-decoration: underline!important; font-size: 16px; } .ucec3ce14c33a0d1e64f5f9d56673c829:hover .postTitle { text-decoration: underline!important; } MESSENGER MARKETING & CHATBOT - Cánh cửa mới cho lĩnh vực tiếp thị số