1. Setting up Heroku
- Visit signup.heroku.com and create an account there.
- After completing the registration process, visit your Heroku Dashboard.
- Create a new app with any name that is available.
2. Setting up a VK community
- Visit vk.com/groups, click
Create community, and fill in the details:
- In your community, go to
- Go to
Messagestab, and enable community messages.
Bot abilities, and then enable
Add start button.
- Go to
- Create a new access token by clicking
Create token. Make sure to check this box:
- Save your new token somewhere.
- Now switch to the
- Set the API version to
- In the
Secret keyfield, enter your own random combination of characters.
Savebelow that field.
- Go back to
Server settingstab and enter in the
your-app-namewith the name you specified when creating a new Heroku app in step 1).
- Don't press
Confirmand don't close this page yet.
3. Setting up environment variables in Heroku
- Open the
Settingstab in your Heroku app, click
Reveal Config Vars, and add variables, as follows:
|Variable name||Description||Example value|
||The token you saved earlier into somewhere||-|
||Number that comes after
||String that comes after
||Any command prefix||
4. Creating the bot
- Make sure you have git and Heroku CLI installed.
- Open up terminal (console), and execute the following commands (assuming your project name on Heroku is
# Clone the example repository git clone https://github.com/u32i64/vk-chat-bot-example.git # Go inside the newly-created folder cd vk-chat-bot-example # Log in to Heroku heroku login # Add the heroku remote heroku git:remote -a some-random-chat-bot # Finally, push the bot to Heroku git push -u heroku master
5. Final steps
- Go to your app's logs (in Heroku app dashboard ->
- If you see a log message like the one below, then the bot has launched successfully:
bot info Server is listening on port 12345
If something is not working, feel free to open an issue on GitHub.
- Now go back to VK's Callback API settings, and press the
- Also, in the
Event typestab, check the following boxes:
- Congratulations, you have just made your own VK chat bot!