SOURCE CODE(OpenAI Facebook Messenger Integration)

April08

New member
"For Educational Purposes Only!!"

Credits and contributors:
-fb-chat-api
-openai
-openweather map
-maryrose143 thread
-wab0u

What is OpenAI?
OpenAI is a research company that aims to create safe and beneficial artificial intelligence. It was founded in December 2015 by a group of philanthropists and researchers, including Elon Musk, Sam Altman, Greg Brockman, Ilya Sutskever, and Wojciech Zaremba, among others. The company's mission is to promote and develop friendly AI for the betterment of society. OpenAI also provides machine learning tools and APIs for developers, researchers, and businesses to create intelligent applications that can impact various sectors of the economy.

What is included in this source code?
  • OpenAI API
  • Facebook Chat API
  • OpenWeatherMap API
  • DALL-E
  • Nodejs Modules
Updated to chatcompletion-gpt-3.5-turbo-0301
Added Message History: The AI can only remember the past 10 conversations to save usage from the OpenAI API .
tested on:
-termux android with packages
-linux
-windows
Notes:
No need to install dependencies.
Use nodejs v15 up. If not working on nodejs v19. downgrade, use nvm.
Default commands to trigger the bot or ai:
Code:
/help - show list of commands to trigger the bot
/forecast 'iNPUT CITY NAME'- show weather forecast.
/weather 'INPUT CITY NAME'- show current weather
/img 'ANY COMMANDS eg. image of a pug'- Generate an image
/ai 'YOUR QUESTION'- Ask the AI
/stop - Stop
/continue - continue the ai
Instructions:
Step 1: Get your fb state.
  • Login to your dummy account.
  • You are going to make your dummy account as the bot or the AI..
  • Install cookie editor extention.
  • Export cookie.
  • Paste it inside session.js.
  • Edit the session.js, search for value "name" rename it all with the value "key".
Step 2: Get your OPENAI API key
  • Go to openai
  • Paste it inside the api_key.json
Step 3: Get openweathermap API key.
  • Go to openweather map sign up and get your apikey.
  • openweather map
  • Paste it inside
  • ../functions/forecast.js
  • ../functions/weather.js
Now execute or run the code:
Code:
node execute.js

 
Top