miftahulkhairim commited on
Commit
7bc8249
Β·
verified Β·
1 Parent(s): 040bd09

Add README

Browse files
Files changed (1) hide show
  1. README.md +65 -4
README.md CHANGED
@@ -1,10 +1,71 @@
1
  ---
2
- title: Whatsapp Bot
3
- emoji: πŸƒ
4
  colorFrom: green
5
- colorTo: yellow
6
  sdk: docker
 
7
  pinned: false
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: WhatsApp Bot
3
+ emoji: πŸ’¬
4
  colorFrom: green
5
+ colorTo: blue
6
  sdk: docker
7
+ app_port: 7860
8
  pinned: false
9
  ---
10
 
11
+ # πŸ’¬ WhatsApp Bot on Hugging Face
12
+
13
+ A WhatsApp chatbot powered by AI, deployed as a Docker Space on Hugging Face.
14
+
15
+ ## Architecture
16
+
17
+ ```
18
+ WhatsApp Cloud API (Meta)
19
+ β”‚
20
+ β–Ό HTTPS webhooks
21
+ https://miftahulkhairim-whatsapp-bot.hf.space/webhook
22
+ β”‚
23
+ β–Ό
24
+ HF Docker Space (FastAPI, port 7860)
25
+ β”œβ”€β”€ GET /webhook β†’ Meta webhook verification
26
+ β”œβ”€β”€ POST /webhook β†’ Receive message β†’ AI reply β†’ Send via WhatsApp API
27
+ └── GET / β†’ Dashboard UI
28
+ ```
29
+
30
+ ## Setup Guide
31
+
32
+ ### 1. Meta Developer Portal Setup
33
+
34
+ 1. Go to [developers.facebook.com](https://developers.facebook.com) β†’ **Create App** β†’ Choose **Business** type
35
+ 2. Add the **WhatsApp** product to your app
36
+ 3. In WhatsApp β†’ Getting Started, note your:
37
+ - **Phone Number ID**
38
+ - **WhatsApp Business Account ID**
39
+ - **Temporary Access Token** (for testing)
40
+ 4. Go to WhatsApp β†’ Configuration β†’ Webhook:
41
+ - **Callback URL**: `https://miftahulkhairim-whatsapp-bot.hf.space/webhook`
42
+ - **Verify Token**: Choose any secret string (e.g., `my_verify_token_2024`)
43
+ - Subscribe to: `messages`
44
+
45
+ ### 2. HF Space Secrets
46
+
47
+ Go to Space Settings β†’ **Repository Secrets** and add:
48
+
49
+ | Secret Name | Value |
50
+ |---|---|
51
+ | `WHATSAPP_VERIFY_TOKEN` | Your chosen verify token string |
52
+ | `WHATSAPP_TOKEN` | Meta access token (from Developer Portal) |
53
+ | `PHONE_NUMBER_ID` | Your WhatsApp Phone Number ID |
54
+ | `HF_TOKEN` | Your HF token (for AI inference) |
55
+
56
+ ### 3. Deploy
57
+
58
+ The Space auto-builds and deploys when you push changes.
59
+
60
+ ## Features
61
+
62
+ - πŸ€– AI-powered responses using Hugging Face Inference API
63
+ - πŸ’¬ Handles text messages from WhatsApp
64
+ - πŸ“Š Web dashboard showing bot status and recent messages
65
+ - πŸ”’ Secure webhook verification
66
+ - ⚑ Async message processing for fast responses
67
+
68
+ ## Notes
69
+
70
+ - Free Spaces sleep after ~15 min of inactivity. Consider upgrading to paid hardware for always-on availability.
71
+ - Access tokens from Meta expire. Use a **System User** permanent token for production.