https://github.com/iranian-github/here-to-help-tg-bot
Telegram Bot for the "Here to Help" project
https://github.com/iranian-github/here-to-help-tg-bot
community-driven free-resources healthcare humanitarian information-directory public-service social-impact social-services telegram telegram-bot
Last synced: 7 months ago
JSON representation
Telegram Bot for the "Here to Help" project
- Host: GitHub
- URL: https://github.com/iranian-github/here-to-help-tg-bot
- Owner: iranian-github
- License: mit
- Created: 2025-02-25T21:03:47.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2025-03-11T10:21:28.000Z (10 months ago)
- Last Synced: 2025-05-21T01:17:06.039Z (8 months ago)
- Topics: community-driven, free-resources, healthcare, humanitarian, information-directory, public-service, social-impact, social-services, telegram, telegram-bot
- Language: TypeScript
- Homepage: https://t.me/iran_here_to_help_bot
- Size: 95.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Here To Help Telegram Bot Worker

A Cloudflare Worker-based Telegram bot that provides information about free support services and resources for people in need. A subproject of the [Here to Help](https://github.com/iranian-github/here-to-help).
## Features
- `/start` - Welcome message and list of available commands
- `/help` - Usage instructions
- `/suicide` - Information about suicide prevention and self-harm
- `/violence` - Information about domestic violence and physical abuse
- `/illness` - Information about chronic illnesses
- `/addiction` - Information about addiction and substance abuse
- `/general` - General support resources
- `/website` - Get the website URL
## Development Setup
1. Clone the repository
```bash
git clone https://github.com/iranian-github/here-to-help-tg-bot
cd here-to-help-tg-bot-worker
```
2. Install dependencies
```bash
npm install
```
3. Copy the sample environment variables file and fill in your values
```bash
cp .dev.vars.sample .dev.vars
```
4. Delete the webhook (if set) to test locally
```bash
curl -X POST https://api.telegram.org/bot/deleteWebhook
```
5. Start the development server
```bash
npm run dev
```
## Local Testing with cURL
Once your development server is running, you can test the bot using cURL commands. Here are some examples:
### Test Regular Messages
```bash
curl -X POST http://localhost:8787 \
-H "Content-Type: application/json" \
-d '{
"message": {
"text": "Hello",
"chat": {"id": YOUR_CHAT_ID},
"from": {"id": YOUR_CHAT_ID}
}
}'
```
### Test Commands
```bash
# Test /start command
curl -X POST http://localhost:8787 \
-H "Content-Type: application/json" \
-d '{
"message": {
"text": "/start",
"chat": {"id": YOUR_CHAT_ID},
"from": {"id": YOUR_CHAT_ID},
"entities": [{"type": "bot_command", "offset": 0, "length": 6}]
}
}'
# Test /help command
curl -X POST http://localhost:8787 \
-H "Content-Type: application/json" \
-d '{
"message": {
"text": "/help",
"chat": {"id": YOUR_CHAT_ID},
"from": {"id": YOUR_CHAT_ID},
"entities": [{"type": "bot_command", "offset": 0, "length": 5}]
}
}'
```
Note: Replace `YOUR_CHAT_ID` with your actual Telegram chat ID.
## Deployment
To deploy to Cloudflare Workers:
```bash
npm run deploy
```
After deployment, set up your webhook URL:
```bash
curl -X POST https://api.telegram.org/bot/setWebhook \
-H "Content-Type: application/json" \
-d '{"url": "https://your-worker-url.workers.dev"}'
```
## License
This software is licensed under the MIT License. for more information, please see the [LICENSE](LICENSE) file.