To develop a Probot app, you will first need a recent version of Node.js installed. Open a terminal and run
node -v to verify that it is installed and is at least 8.3.0 or later. Otherwise, install the latest version.
create-probot-app is the best way to start building a new app. It will generate a new app with everything you need to get started and run your app in production.
To get started, run one of these commands:
$ npx create-probot-app my-first-app
$ yarn create probot-app my-first-app
This will ask you a series of questions about your app, which should look something like this:
Let's create a Probot app! ? App name: my-first-app ? Description of app: A "Hello World" GitHub App built with Probot ? Author's full name: Katie Horne ? Author's email address: firstname.lastname@example.org ? Homepage: ? GitHub user or org name: khorne3 ? Repository name: my-first-app created file: my-first-app/.env.example created file: my-first-app/.gitignore created file: my-first-app/.travis.yml created file: my-first-app/LICENSE created file: my-first-app/README.md created file: my-first-app/app.json created file: my-first-app/index.js created file: my-first-app/package-lock.json created file: my-first-app/package.json created file: my-first-app/docs/deploy.md Finished scaffolding files! Installing Node dependencies! Done! Enjoy building your Probot app!
The most important files note here are
index.js, which is where the code for your app will go, and
package.json, which makes this a standard npm module.
To run your app in development, you will need to configure a GitHub App to deliver webhooks to your local machine.
.envto the URL that you are redirected to.
WEBHOOK_PROXY_URLfrom the previous step.
APP_IDto the ID of the app you just created. The App ID can be found in your app settings page here
You'll need to create a test repository and install your app by clicking the "Install" button on the settings page of your app, e.g.
Now you're ready to run the app on your local machine. Run
npm run dev to start the server:
$ npm run dev > email@example.com dev /Users/z/Desktop/foo > nodemon --exec "npm start" [nodemon] 1.17.2 [nodemon] to restart at any time, enter `rs` [nodemon] watching: *.* [nodemon] starting `npm start` > firstname.lastname@example.org start /Users/z/Desktop/foo > probot run ./index.js Yay, the plugin was loaded! 18:11:55.838Z DEBUG Probot: Loaded plugin: ./index.js
dev script will start your app using nodemon, which will watch for any files changes in your local development environment and automatically restart the server.
Other available scripts
$ npm startto start your app without watching files.
$ npm run lintto lint your code using standard.
$ npm installand restart the server if
$ LOG_LEVEL=trace npm start
Found a mistake or want to help improve this documentation? Suggest changes on GitHub