Skip to main content

Deploying with Heroku

Powered by Wechaty Build Status Greenkeeper badge

Using the "Deploy to Heroku" Button

The ‘Deploy to Heroku’ button enables users to deploy apps to Heroku without leaving the web browser, and with little or no configuration. The button is ideal for customers, open-source project maintainers or add-on providers who wish to provide their customers with a quick and easy way to deploy and configure a Heroku app.

Deploy to Heroku for Wechaty Starter Project Repository

This is a sample deploy with Heroku button for the Wechaty Heroku starter project.

Setting up a Deploy to Heroku Button

This guide demonstrates setting up a Deploy to Heroku Button with Wechaty Starter Repository.

  1. Fork the Wechaty Starter Repository

  2. Create a branch feature in the forked repository.

  3. On branch feature, create an app.json file in the root directory. Add items including name, description, logo in the fields. If you want to know how an app.json file looks like, check out heroku-wechaty-getting-started templete

  4. In the Readme.md file, add the following code snippet:

`[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)`
  1. The deploy with heroku button is now set up.

Heroku button

Deploying with Heroku

This guide demonstrates running the ding-dong bot with Heroku CLI. However you can choose to run any custom bot, with similar steps.

Prerequisites

  1. Fork the Wechaty Starter Repository

  2. Clone the Starter repository.

git clone https://github.com/wechaty/wechaty-getting-started
  1. Download the Heroku Cli

Getting Started

  1. On branch feature, create an app.json file in the root directory.Add in fields such as name, description, logo, etc. If you want to know how an app.js file looks like check heroku-wechaty-getting-started
  2. On branch feature, create a file named Procfile in the root directory.Note that this file has no extension. Write the following code in the file:
web:WECHATY_LOG=verbose WECHATY_PUPPET=wechaty-puppet-whatsapp node examples/ding-dong-bot.js
  1. Commit the changes in the feature branch.

Creating a Heroku Remote

  1. Open the following link in your browser:
https://heroku.com/deploy?template=https://github.com/user-name/wechaty-getting-started/tree/feature

Remember to replace user-name with your Github username.

  1. Add the necessary details and click on deploy app button. Heroko Image 1 Heroko Image 1

  2. After the app has been successfully created, open the terminal and add the heroku remote to your local github repository.

heroku git:remote -a wechaty-test-123

Here wechaty-test-123 is the name of the app, created in the previous step. You have to write your own app name.

  1. Push the feature branch of your local repository to the main branch of heroku using the following command:
git push heroku feature:main

Running the bot

To run the Bot on the Heroku CLI use the command heroku local web on your terminal. The ding-dong starter bot is now successfully running. Heroku button

Use Cases

  1. Friday BOT - bot-friday.herokuapp.com
  2. OSSBot - oss-bot-dev.herokuapp.com
  3. Mike BO - mike-bo.herokuapp.com
  4. QiJi BOT - qiji-bot.herokuapp.com
  5. Bot Ops - bot-ops.herokuapp.com
  6. Rui Assistant BOT
  7. Juzi.BOT