This self-hosted app uses Telegram to gather daily meal details and feelings from users, analyzing this data with ChatGPT's API to estimate the nutritional content.
Daily Logging via Telegram: Each day, the app sends messages through Telegram asking about your meals and how you feel. These questions are designed to gather detailed information about what you ate during the day.
ChatGPT-Powered Analysis: Utilizing your responses sent via Telegram, the app employs the ChatGPT API to analyze and estimate the nutritional content of your daily diet. This includes assessing the amounts of carbohydrates, sugars, and other key nutritional elements of your meals.
Personal Data Storage: The app is currently focused on securely storing all collected data in a database. This information, accessible to you, can be used at your discretion. Plans are in place to enhance the app with features for structured data visualization, such as tables, and capabilities to automatically identify dietary patterns in the future.
In its current form, the app acts as a sophisticated tool for data collection and personal health monitoring, leveraging Telegram for convenient daily interactions and ChatGPT's advanced analytics for nutritional insights.
- Clone this repository:
git clone alfonsobries/&
- The app is built on Laravel. Visit Laravel documentation for instructions.
- This app only requires a single user; you can optionally add the user details to your
.env
file:
ADMIN_EMAIL=alfonso@example.com
ADMIN_PASSWORD=my-password
ADMIN_NAME=Alfonso
- Run a fresh migration:
php artisan migrate:fresh --seed
- On Telegram: Start a conversation with BotFather by searching for @BotFather.
- Create a new bot using the
/newbot
command and follow the instructions. - Assign a name, such as
'mytracker9000_bot'
. It must end with '_bot'. - Receive the token, which will look similar to
1234567890:AAG2eDLduCRjsgHlms1EezWoCqBlpsSJexE
. - Add the token to your
.env
file:TELEGRAM_BOT_TOKEN={your_token}
- Obtain a new API key from OpenAI.
- Add the API key to your
.env
file:OPENAI_KEY=sk-12345
- Use the same steps as in section 3 for obtaining and adding the OpenAI API key.
- Ensure the
APP_URL
in your .env file is publicly accessible (if testing locally, you can use a tool like expose). - Run
php artisan telegram:set-webhook
in the terminal; you should see a success message. - Then, run
php artisan telegram:code
in the terminal; you should receive a command like the one shown below.
Telegram command is:
/start bcJpdiI6InlCbUo0USthMStXVUNCbmxGVFVKTUE9PSIsInZhbHVlIjoiWFZwbnFTN1QvQ1BObDU4VG01ZTZhRlJqeUJudFVIciswbUZNYVJpaHdXWT0iLCJtYWMiOiJmNjdlYTZhNTE2M2JiNmFjZTdkMDhmNWIzYzkzMWFjYTY5YzRtMmU2NzQyNmJlMzIyYjI2NTk3ODJhZjc2MzcxIiwidGFnIjoiIn0
- Copy the command starting with
/start
. - Search for your bot on Telegram and send the command as a message.
- If everything goes well, you should receive a success message from the Telegram bot.