# swapagarwal/jarvis-on-messenger architecture

> Architecture diagram of the GitHub repository swapagarwal/jarvis-on-messenger, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/swapagarwal/jarvis-on-messenger
- Repository: https://github.com/swapagarwal/jarvis-on-messenger

## Overview

JARVIS is a Python chatbot that turns Messenger messages into intent-driven feature results and sends responses back through Messenger. The main flow is webhook input, Wit.ai intent/entity resolution (or a postback), feature dispatch, and a structured message response. The feature modules span conversation, information lookup, media, and utilities; shared templates shape Messenger output. The README documents additional integrations and data-backed features, but many feature implementations were not excerpted, so their internal calls are not inferred.

Main entry points: [`modules/__init__.py`](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/__init__.py) (Query and feature dispatcher), [`jarvis.py`](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/jarvis.py) (Webhook and HTTP routes), [`modules/src/movie.py`](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/movie.py) (Movie lookup), [`templates/button.py`](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/templates/button.py) (Button messages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Bot entry"]
  node_webhook["Webhook and HTTP routes<br/>[jarvis.py]"]
end

subgraph group_routing["Intent routing"]
  node_dispatcher["Query and feature dispatcher<br/>[__init__.py]"]
end

subgraph group_conversation["Conversation"]
  node_hello["Hello<br/>[hello.py]"]
  node_bye["Goodbye<br/>[bye.py]"]
  node_thanks["Thanks<br/>[thanks.py]"]
  node_help["Help<br/>[help.py]"]
  node_request["Feature requests<br/>[request.py]"]
  node_fact["Facts<br/>[fact.py]"]
  node_joke["Jokes<br/>[joke.py]"]
  node_quote["Quotes<br/>[quote.py]"]
end

subgraph group_lookup["Information lookup"]
  node_anime["Anime lookup<br/>[anime.py]"]
  node_book["Book lookup<br/>[book.py]"]
  node_dictionary["Dictionary<br/>[dictionary.py]"]
  node_movie["Movie lookup<br/>[movie.py]"]
  node_news["News<br/>[news.py]"]
  node_time["Time zones<br/>[time.py]"]
  node_weather["Weather<br/>[weather.py]"]
  node_wiki["Wikipedia<br/>[wiki.py]"]
  node_coin["Coin flip<br/>[coin.py]"]
  node_dice["Dice roll<br/>[dice.py]"]
  node_currency["Currency conversion<br/>[currency.py]"]
  node_ping["Availability check<br/>[ping.py]"]
  node_url["URL tools<br/>[url.py]"]
end

subgraph group_media["Media discovery"]
  node_music["Music search<br/>[music.py]"]
  node_lyrics["Lyrics search<br/>[lyrics.py]"]
  node_video["Video search<br/>[video.py]"]
  node_xkcd["xkcd comics<br/>[xkcd.py]"]
end

subgraph group_presentation["Message presentation"]
  node_text["Text messages<br/>[text.py]"]
  node_button["Button messages<br/>[button.py]"]
  node_generic["Generic cards<br/>[generic.py]"]
  node_quick_replies["Quick replies<br/>[quick_replies.py]"]
end

node_messenger_user(("Messenger user"))
node_messenger(("Facebook Messenger"))
node_wit(("Wit.ai"))

node_messenger_user -->|"sends message"| node_messenger
node_messenger -->|"delivers events"| node_webhook
node_webhook -->|"routes query"| node_dispatcher
node_webhook -->|"sends response"| node_messenger
node_dispatcher -->|"resolves intent"| node_wit
node_dispatcher -->|"dispatches intent"| node_hello
node_dispatcher -->|"dispatches intent"| node_bye
node_dispatcher -->|"dispatches intent"| node_thanks
node_dispatcher -->|"dispatches intent"| node_help
node_dispatcher -->|"dispatches intent"| node_request
node_dispatcher -->|"dispatches intent"| node_fact
node_dispatcher -->|"dispatches intent"| node_joke
node_dispatcher -->|"dispatches intent"| node_quote
node_dispatcher -->|"dispatches intent"| node_anime
node_dispatcher -->|"dispatches intent"| node_book
node_dispatcher -->|"dispatches intent"| node_dictionary
node_dispatcher -->|"dispatches intent"| node_movie
node_dispatcher -->|"dispatches intent"| node_news
node_dispatcher -->|"dispatches intent"| node_time
node_dispatcher -->|"dispatches intent"| node_weather
node_dispatcher -->|"dispatches intent"| node_wiki
node_dispatcher -->|"dispatches intent"| node_music
node_dispatcher -->|"dispatches intent"| node_lyrics
node_dispatcher -->|"dispatches intent"| node_video
node_dispatcher -->|"dispatches intent"| node_xkcd
node_dispatcher -->|"dispatches intent"| node_coin
node_dispatcher -->|"dispatches intent"| node_dice
node_dispatcher -->|"dispatches intent"| node_currency
node_dispatcher -->|"dispatches intent"| node_ping
node_dispatcher -->|"dispatches intent"| node_url
node_dispatcher -->|"adds fallback"| node_text
node_dispatcher -->|"adds options"| node_quick_replies
node_music -->|"builds cards"| node_generic
node_movie -->|"builds buttons"| node_button
node_movie -->|"formats text"| node_text
node_generic -->|"uses buttons"| node_button
node_button -->|"uses text helper"| node_text

click node_webhook "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/jarvis.py"
click node_dispatcher "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/__init__.py"
click node_hello "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/hello.py"
click node_bye "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/bye.py"
click node_thanks "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/thanks.py"
click node_help "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/help.py"
click node_request "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/request.py"
click node_fact "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/fact.py"
click node_joke "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/joke.py"
click node_quote "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/quote.py"
click node_anime "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/anime.py"
click node_book "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/book.py"
click node_dictionary "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/dictionary.py"
click node_movie "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/movie.py"
click node_news "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/news.py"
click node_time "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/time.py"
click node_weather "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/weather.py"
click node_wiki "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/wiki.py"
click node_music "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/music.py"
click node_lyrics "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/lyrics.py"
click node_video "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/video.py"
click node_xkcd "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/xkcd.py"
click node_coin "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/coin.py"
click node_dice "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/dice.py"
click node_currency "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/currency.py"
click node_ping "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/ping.py"
click node_url "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/url.py"
click node_text "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/templates/text.py"
click node_button "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/templates/button.py"
click node_generic "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/templates/generic.py"
click node_quick_replies "https://github.com/swapagarwal/jarvis-on-messenger/blob/master/templates/quick_replies.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webhook,node_messenger_user toneBlue
class node_dispatcher toneAmber
class node_hello,node_bye,node_thanks,node_help,node_request,node_fact,node_joke,node_quote toneMint
class node_anime,node_book,node_dictionary,node_movie,node_news,node_time,node_weather,node_wiki,node_coin,node_dice,node_currency,node_ping,node_url toneRose
class node_music,node_lyrics,node_video,node_xkcd,node_messenger,node_wit toneIndigo
class node_text,node_button,node_generic,node_quick_replies toneTeal
```

## Components

### Bot entry

- [Webhook and HTTP routes](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/jarvis.py): `jarvis.py`

### Intent routing

- [Query and feature dispatcher](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/__init__.py): `modules/__init__.py`

### Conversation

- [Hello](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/hello.py): `modules/src/hello.py`
- [Goodbye](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/bye.py): `modules/src/bye.py`
- [Thanks](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/thanks.py): `modules/src/thanks.py`
- [Help](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/help.py): `modules/src/help.py`
- [Feature requests](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/request.py): `modules/src/request.py`
- [Facts](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/fact.py): `modules/src/fact.py`
- [Jokes](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/joke.py): `modules/src/joke.py`
- [Quotes](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/quote.py): `modules/src/quote.py`

### Information lookup

- [Anime lookup](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/anime.py): `modules/src/anime.py`
- [Book lookup](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/book.py): `modules/src/book.py`
- [Dictionary](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/dictionary.py): `modules/src/dictionary.py`
- [Movie lookup](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/movie.py): `modules/src/movie.py`
- [News](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/news.py): `modules/src/news.py`
- [Time zones](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/time.py): `modules/src/time.py`
- [Weather](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/weather.py): `modules/src/weather.py`
- [Wikipedia](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/wiki.py): `modules/src/wiki.py`
- [Coin flip](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/coin.py): `modules/src/coin.py`
- [Dice roll](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/dice.py): `modules/src/dice.py`
- [Currency conversion](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/currency.py): `modules/src/currency.py`
- [Availability check](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/ping.py): `modules/src/ping.py`
- [URL tools](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/url.py): `modules/src/url.py`

### Media discovery

- [Music search](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/music.py): `modules/src/music.py`
- [Lyrics search](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/lyrics.py): `modules/src/lyrics.py`
- [Video search](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/video.py): `modules/src/video.py`
- [xkcd comics](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/modules/src/xkcd.py): `modules/src/xkcd.py`

### Message presentation

- [Text messages](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/templates/text.py): `templates/text.py`
- [Button messages](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/templates/button.py): `templates/button.py`
- [Generic cards](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/templates/generic.py): `templates/generic.py`
- [Quick replies](https://github.com/swapagarwal/jarvis-on-messenger/blob/master/templates/quick_replies.py): `templates/quick_replies.py`

### Other components

- **Messenger user**
- **Facebook Messenger**
- **Wit.ai**

## Connections

- Messenger user → Facebook Messenger: sends message (evidence: `README.md`)
- Facebook Messenger → Webhook and HTTP routes: delivers events (evidence: `jarvis.py`)
- Webhook and HTTP routes → Query and feature dispatcher: routes query (evidence: `jarvis.py`)
- Webhook and HTTP routes → Facebook Messenger: sends response (evidence: `jarvis.py`)
- Query and feature dispatcher → Wit.ai: resolves intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Hello: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Goodbye: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Thanks: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Help: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Feature requests: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Facts: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Jokes: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Quotes: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Anime lookup: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Book lookup: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Dictionary: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Movie lookup: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → News: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Time zones: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Weather: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Wikipedia: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Music search: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Lyrics search: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Video search: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → xkcd comics: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Coin flip: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Dice roll: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Currency conversion: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Availability check: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → URL tools: dispatches intent (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Text messages: adds fallback (evidence: `modules/__init__.py`)
- Query and feature dispatcher → Quick replies: adds options (evidence: `modules/__init__.py`)
- Music search → Generic cards: builds cards (evidence: `modules/src/music.py`)
- Movie lookup → Button messages: builds buttons (evidence: `modules/src/movie.py`)
- Movie lookup → Text messages: formats text (evidence: `modules/src/movie.py`)
- Generic cards → Button messages: uses buttons (evidence: `templates/generic.py`)
- Button messages → Text messages: uses text helper (evidence: `templates/button.py`)
