-
-
Notifications
You must be signed in to change notification settings - Fork 398
Deploy with Heroku
Sumanjay edited this page Jul 1, 2021
·
27 revisions
- Heroku account
- MongoDB
- YouTube Data API Key
- A Terminal to generate the Session (Local \ Repl)
1. You Have to create a whatsapp session that Whatsbot can start. You can do it by cloning this repo and run genToken.js
, You can follow these steps also π
Method 1
- Open it in any terminal (NodeJS and Npm) and run the following codes
git clone https://github.com/TheWhatsBot/WhatsBot.git
cd WhatsBot
npm install
node genToken.js
- You will see a QR code, scan this QR code from your Phone's Whatsapp Web QR scanner.
- After you successfully do that you will got a JSON output. Copy that it will be needed while you deploy.
Method 2
Go to https://ssh.cloud.google.com
or https://labs.play-with-docker.com/
- Run This
docker run jeeetpaul/whatsbot-session
- Scan QR Code with Whatsapp and copy the JSON
Method 3
- Open
https://web.whatsapp.com
(On PC) and login - Open Developer Tools and go to console
- Paste this π
const WhatsBlob = document.createElement("a");
WhatsBlob.href = URL.createObjectURL(new Blob([JSON.stringify({
WABrowserId: localStorage.getItem("WABrowserId"),
WASecretBundle: localStorage.getItem("WASecretBundle"),
WAToken1: localStorage.getItem("WAToken1"),
WAToken2: localStorage.getItem("WAToken2")
}, null, 2)], { type: 'application/json' }));
WhatsBlob.download = "session.json";
document.body.appendChild(WhatsBlob);
WhatsBlob.dispatchEvent(
new MouseEvent('click', {
bubbles: true,
cancelable: true,
view: window
})
);
- A file named
session.json
will be downloaded, Open that and copy.
- Open
https://cloud.mongodb.com
- Click the
Try MongoDB Cloud Now
Button - Now you can Fill the Form or Sign Up with Google
- After Successfully Signed Up Type any Organization Name, Project Name and select any preferred language and click
Continue
- You can see a Pricing Page select
Free
and clickCreate a Cluster
- Select AWS North Amarica or Europe server only because heroku's server are also located there and click
Create Cluster
- Now you will see a cluster is creating
- click
Network Access
in Sidebar & clickAdd IP Address
- Now click
ALLOW ACCESS FROM ANYWHERE
andConfirm
that - click
Database Access
in Sidebar & clickAdd New Database User
- Now in Password Authentication Method type an Username and a Password and click
Add User
- click
Clusters
in Sidebar & clickconnect
& SelectConnect your application
- Now you will see an url containing
mongodb+srv://
Copy that and replace< password >
with Your Previously chosen password (If you used any special character in password you have to url encode the password) - You need this MongoDB url to deploy Whatsbot
- Open
https://console.cloud.google.com/
& create a project - Go to
Apis & Services
and searchYoutube Data Api
you will foundYouTube Data API v3
select that and enable that - Now again go to
Apis & Services
clickCredentials
and clickCREATE CREDENTIALS
& selectAPI Key
- An API Key will be displayed Copy That it will need while you deploy Whatsbot
- Click this button π
- Give an APP Name
- Select the server according to your MongoDB server's Location, It will Speed Up Database intensive works
-
DEFAULT_TR_LANG
- It is the default translation language for Translator Module. Default Value isen
-
MONGODB_URL
- MongoDB url you grabbed before -
PMPERMIT_ENABLED
- Enable Pmpermit or Disable it. Writetrue
orfalse
. Default Value istrue
-
PMPERMIT_MUTETIME
- How many seconds an user get muted if he is spamming. Default is 30 Minutes (1800 Secs) -
SESSION
- That JSON you grabbed before by runninggenToken.js
-
YT_DATA_API_KEY
- Youtube DATA API Key you grabbed before from GCP -
OCR_SPACE_API_KEY
- OCR Space API Key. You can get the API Key from here
- Open
https://cron-job.org
its free - Click Sign Up and Complete the Signup
- After that click
cronjobs
in navigation header & clickCreate Cron Job
- Give your heroku application url
- Schedule it in every 15 minutes
- Everything rest will be default
- click
Create Cronjob
to create a cron job