Complete, production-ready skill for AI agents to write correct GREEN-API WhatsApp SDK code in C++
- Read:
SKILL.md- Main skill with initialization, patterns, and 5 runnable scenarios - Reference:
references/- Detailed documentation for 61 methods across 9 categories - Implement: Use templates from SKILL.md to generate correct code
- Verify: Check against the method index
- Download
SKILL.mdandreferences/folder - Paste into AI agent context (Claude, Cursor, etc.)
- Request code with reference to SKILL.md
- Get working code that compiles and runs first time
| File | Purpose | Size |
|---|---|---|
| SKILL.md | Main entry point: initialization, patterns, scenarios | 19 KB |
| SKILL-USAGE.md | How to use this skill with AI agents | 7 KB |
| SKILL-SUMMARY.md | Statistics and verification results | 10 KB |
| SKILL-README.md | This navigation guide | - |
references/
├── sending.md # 11 methods - Messages, files, media
├── receiving.md # 3 methods - Polling, notifications, downloads
├── account.md # 11 methods - Auth, settings, state
├── groups.md # 9 methods - Group management
├── journals.md # 6 methods - History and logs
├── statuses.md # 7 methods - WhatsApp Stories
├── queues.md # 2 methods - Queue management
├── readMark.md # 1 method - Read status
└── serviceMethods.md # 11 methods - Utilities & contacts
Every method mentioned in this skill:
- ✓ Exists in SDK source code
- ✓ Name matches exactly (grep verified)
- ✓ Parameters documented with types
- ✓ Response format shown with JSON
- ✓ Linked to official docs
Verification: bash /tmp/verify_methods.sh → 61/61 ✓
// Fully working code in SKILL.md "Scenario 1"
nlohmann::json msg = {{"chatId", "79876543210@c.us"}, {"message", "Hello"}};
Response resp = client.sending.sendMessage(msg);// Complete polling loop in SKILL.md "Scenario 2"
while (true) {
Response notif = client.receiving.receiveNotification(5);
// Process notification...
}// File attachment example in references/sending.md
nlohmann::json fileMsg = {
{"chatId", "79876543210@c.us"},
{"urlFile", "https://example.com/image.jpg"}
};
client.sending.sendFileByUrl(fileMsg);// Group creation example in references/groups.md
nlohmann::json group = {
{"groupName", "My Team"},
{"participants", {"79876543210@c.us", "79876543211@c.us"}}
};
Response resp = client.groups.createGroup(group);// Webhook setup in SKILL.md "Scenario 5"
nlohmann::json settings = {
{"webhookUrl", "https://your-server.com/webhook"}
};
client.account.setSettings(settings);Sending (11 methods) → references/sending.md
sendMessage, sendPoll, sendFileByUpload, sendFileByUrl, uploadFile, getFileSaveTime, sendLocation, sendContact, forwardMessages, sendInteractiveButtons, sendInteractiveButtonsReply
Receiving (3 methods) → references/receiving.md
receiveNotification, deleteNotification, downloadFile
Account (11 methods) → references/account.md
getSettings, setSettings, getStateInstance, getStatusInstance, reboot, logout, qr, scanqrcode, getAuthorizationCode, getWaSettings, getStateInstanceHistory
Groups (9 methods) → references/groups.md
createGroup, updateGroupName, getGroupData, addGroupParticipant, removeGroupParticipant, setGroupAdmin, removeAdmin, leaveGroup, updateGroupSettings
Journals (6 methods) → references/journals.md
getChatHistory, getMessage, lastIncomingMessages, lastOutgoingMessages, lastIncomingCalls, lastOutgoingCalls
Statuses (7 methods) → references/statuses.md
sendTextStatus, sendVoiceStatus, sendMediaStatus, deleteStatus, getStatusStatistic, getIncomingStatuses, getOutgoingStatuses
Queues (2 methods) → references/queues.md
showMessagesQueue, clearMessagesQueue
ReadMark (1 method) → references/readMark.md
readChat
ServiceMethods (11 methods) → references/serviceMethods.md
checkWhatsapp, getAvatar, getContacts, getContactInfo, editMessage, deleteMessage, archiveChat, unarchiveChat, setDisappearingChat, getChats, sendTyping
- Personal:
79876543210@c.us(must include@c.us) - Group:
79876543210-1581234048@g.us(must include@g.us) - Wrong format → silent failure!
- Send delay: 900ms minimum (configurable)
- Group creation: 1 per 5 minutes max
- Exceeding → 429 error or queued
// Always verify authorization first
Response auth = client.account.getStateInstance();
if (auth.body["stateInstance"] != "authorized") {
// Trigger QR or phone auth
}Response resp = client.sending.sendMessage(msg);
if (resp.success) {
// Safe to access resp.body
} else {
// HTTP error: check resp.statusCode
}- Read SKILL.md section matching the task
- Find template in "Common Scenarios"
- Check references/*.md for specific method details
- Generate code based on template
- Add error handling from error codes guide
- Verify method names match quick index
User: "Send a text message to +79876543210"
↓
Agent reads SKILL.md "Scenario 1: Sending Text Message"
↓
Agent generates code with proper error handling
↓
Agent verifies:
- Method name: sendMessage ✓
- Chat ID format: 79876543210@c.us ✓
- Auth check: included ✓
- Error handling: present ✓
↓
Agent outputs working code
# 1. Export credentials
export GREEN_API_ID="your_instance_id"
export GREEN_API_TOKEN="your_token"
# 2. Compile (in repo root after cmake build)
g++ -std=c++17 -o test_msg your_code.cpp -L./build -lgreenapi -I./include
# 3. Run
./test_msg
# 4. Verify:
# - No compilation errors
# - No crashes
# - Message sent (check console & WhatsApp)- Official Docs: https://green-api.com/en/docs/api/
- SDK Repo: https://github.com/green-api/whatsapp-api-client-cpp
- Get Credentials: https://console.green-api.com
- Request Format: https://green-api.com/en/docs/api/request-format/
Each references/*.md file includes:
- ✓ Method purpose and when to use
- ✓ C++ signature and parameter types
- ✓ Required vs optional parameters
- ✓ JSON response format
- ✓ Real code examples
- ✓ Error cases and solutions
- ✓ Link to official docs
| Metric | Value |
|---|---|
| Total Methods | 61 |
| Verified | 61/61 ✓ |
| Code Scenarios | 5 |
| Reference Docs | 9 |
| Documentation | 4,266 lines |
| Code Examples | 50+ |
| Error Cases | 30+ |
- ✅ Zero guesswork - All from official docs + SDK source
- ✅ Zero speculation - Every method verified to exist
- ✅ Zero hidden methods - All 61 documented
- ✅ Production-ready - Code examples are complete & tested
- ✅ Agent-friendly - Clear patterns for AI code generation
- ❌ Wrong chat ID format → ✅ Always use
@c.usor@g.us - ❌ Ignore auth status → ✅ Check
getStateInstance()first - ❌ Don't check
response.success→ ✅ Always verify before accessing body - ❌ Hardcode credentials → ✅ Use environment variables
- ❌ Ignore rate limits → ✅ Respect delays and group creation limits
When SDK updates:
- Run:
bash /tmp/verify_methods.sh - If new methods: Add to appropriate reference
- If removed: Remove from docs
- Re-verify and update statistics
If AI-generated code doesn't work:
- ✓ Check method name in SKILL.md index
- ✓ Verify chat ID format (
@c.usor@g.us) - ✓ Confirm instance is authorized
- ✓ Check rate limits (delays, group creation)
- ✓ Review error code in official docs
- ✓ Read error handling section in SKILL.md
- Client initialization
- 5 runnable scenarios
- Best practices & pitfalls
- Error codes & solutions
- Quick method index
- How to use with AI agents
- Verification checklist
- Common patterns
- Testing guide
- Maintenance instructions
- Statistics (61 methods)
- Verification results
- Coverage by category
- QA checklist
- Sources (official docs + SDK)
- Detailed per-method documentation
- Parameters with types
- Response formats with JSON
- Code examples
- Links to official docs
Version: 1.0.0 Status: ✅ Production Ready Last Updated: 2024 All Methods Verified: 61/61 ✓
Start with: SKILL.md