World map

 

BM: Baca dalam Bahasa Melayu

World 9: Power Tools

API, webhooks and Apps

You will learn: how programs talk to GitHub, and how to tell an API, a webhook and an App apart.

The problem

Your club wants a screen that shows new issues as they arrive. Do you sit and refresh GitHub all day?

Pick one answer.

Watch

bash
gh api repos/aina-codes/diary --jq .stargazers_count
3
gh api asks GitHub's API how many stars the diary repo has. The answer is 3.

An API: A service window for programs. A program asks, and the website answers with data. is a service window for programs. A program asks a question. GitHub answers with data. gh api lets you ask from the terminal.

Watch

Tap each point on the timeline.

A webhook: A doorbell: GitHub calls your web address when something happens. is a doorbell. When something happens, GitHub calls your web address. Nobody has to keep asking.

Try it

Ask, or get told? Sort each job.

Drag a card into a box. Or tap the card, then tap the box.

      Watch

      A GitHub App: A robot helper you install on chosen repos, with only the permissions it needs. is a robot helper. You install it on the repos you choose. Before you install, you see what it may do. Bots that label issues or check pull requests are often Apps.

      Predict

      An app only posts a weekly report. It asks to change your settings and read all your code. Do you install it?

      Pick one answer.

      Check

      Good habit, or needs work? Swipe each one.

      Swipe right for good, left for needs work. Or use the buttons.

      1 / 4

      Install an app only on the repos it needs

      Install an app only on the repos it needs

      You did it!

      You can now tell an API, a webhook and an App apart.

      Go deeper (optional)

      GitHub has a REST API and a GraphQL API. You can read public data without signing in. But the limits are lower. FahamLah’s mission checks do exactly that. Webhooks can sit on a repo, an organisation or an App. Apps use short-lived tokens, so a leak hurts less.