Agent skill

Greenapi Client Python

by green-api in green-api/whatsapp-api-client-python

Write correct Python code with the official GREEN-API SDK whatsapp-api-client-python (package whatsappapiclientpython).

MITAuto-check passedProductivity & Automation

Install Greenapi Client Python

skills CLI
$ npx skills add green-api/whatsapp-api-client-python --skill greenapi-client-python -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install green-api/whatsapp-api-client-python greenapi-client-python --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/green-api/whatsapp-api-client-python.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills .claude/skills/greenapi-client-python && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
greenapi-client-python
GitHub stars
209
Token cost
~3.3k tokens
SKILL.md length
947 words
Files
14 (incl. references)
Skills in repo
1
Repo updated
First seen
Licence
MIT

At a glance

Write correct Python code with the official GREEN-API SDK whatsapp-api-client-python (package whatsappapiclientpython).

  • Works in 6 steps: Send a text message → Send a file by URL → Send a file by upload (local path) → …
  • Sending/receiving WhatsApp messages
  • SKILL.md covers When to apply, Sources of truth (mandatory), Install and Client initialization, plus 7 more sections
  • Calls python; reaches api.green-api.com and media.green-api.com; needs PARTNER_TOKEN

What it does

Greenapi Client Python is an agent skill from green-api/whatsapp-api-client-python. Write correct Python code with the official GREEN-API SDK whatsapp-api-client-python (package whatsappapiclientpython). Use when sending/receiving WhatsApp messages, files, polls, groups, journals, queues, statuses, contacts, partner instances, polling notifications, or configuring a GREEN-API instance in Python. Triggers: GREEN-API, green-api, whatsapp-api-client-python, GreenAPI, GreenApi, sendMessage, receiveNotification.

Its SKILL.md is about 3.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 14 other files, including reference files (for example `references/account.md`, `references/contacts.md` and `references/device.md`).

It sits in Productivity & Automation, covering Messaging and chat bots. It works with Python and WhatsApp. The repository describes itself as: This library helps you easily create a Python application with WhatsApp API. The licence is MIT.

When your agent uses it

  • Sending/receiving WhatsApp messages
  • Partner instances
  • Polling notifications
  • Configuring a GREEN-API instance in Python

Example prompts

  • “/greenapi-client-python”

Requirements

  • Python 3
  • A credential in PARTNER_TOKEN

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Send a text message
  2. Send a file by URL
  3. Send a file by upload (local path)
  4. Receive notifications — polling (built-in)
  5. Receive notifications — webhook endpoint (your HTTP server)
  6. Create a group and message it

What it can do on your machine

Read from SKILL.md and the folder at commit f84f9ab. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • python

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • api.green-api.com
    • media.green-api.com
    • download.samplelib.com

    Also links to:

    • green-api.com
    • console.green-api.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • PARTNER_TOKEN

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Greenapi Client Python loads about 3.3k tokens when it runs, and up to ~12k if it reads all its reference files. Until then it costs about 114 tokens; SKILL.md has 947 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~114
When it runs · the whole SKILL.md, loaded when a task matches
~3.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~12k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from green-api/whatsapp-api-client-python at commit f84f9ab, republished under its MIT licence (© green-api). 947 words, ~3,280 tokens.

Download SKILL.mdSave it as .claude/skills/greenapi-client-python/SKILL.md (or your agent's skills folder). This skill also uses 13 other files; get the full folder from GitHub.
name
greenapi-client-python
description
Write correct Python code with the official GREEN-API SDK whatsapp-api-client-python (package whatsapp_api_client_python). Use when sending/receiving WhatsApp messages, files, polls, groups, journals, queues, statuses, contacts, partner instances, polling notifications, or configuring a GREEN-API instance in Python. Triggers: GREEN-API, green-api, whatsapp-api-client-python, GreenAPI, GreenApi, sendMessage, receiveNotification.
license
MIT
metadata.version
1.0.0
metadata.sdk
whatsapp-api-client-python
metadata.pypi
whatsapp-api-client-python
metadata.docs
https://green-api.com/en/docs/api/
metadata.github
https://github.com/green-api/whatsapp-api-client-python

GREEN-API Python client (whatsapp-api-client-python)

When to apply

Use this skill whenever the task is to call GREEN-API from Python via the official SDK. Do not invent HTTP paths or method names from memory: only methods listed in references/inventory.md exist in this SDK. Semantics of parameters, chatId formats, delays, and notification types come from the official docs linked in each method section — not from other repos.

For webhook HTTP server libraries in other languages, use a language-specific webhook skill if present. This SDK receives notifications via polling (webhooks.startReceivingNotifications / receiving.receiveNotification) or you can build your own HTTP endpoint for webhook-endpoint technology.

Sources of truth (mandatory)

  1. Official API docs — https://green-api.com/en/docs/api/
    Parameters, response shapes, limits, chatId, delays, notification formats.
  2. This repository / installed package — method names, class attributes, init signatures. Inventory: references/inventory.md.

If a method exists in the docs but not in the inventory → do not use it in code.

Install

shell
python -m pip install whatsapp-api-client-python

Requires Python >= 3.10. Credentials: idInstance and apiTokenInstance from console.green-api.com.

Client initialization

python
from whatsapp_api_client_python import API

greenAPI = API.GreenAPI(
    "1101000001",  # idInstance (string)
    "d75b3a66374942c5b3c019c698abc2067e151558acbd412345",  # apiTokenInstance
)

Optional constructor kwargs (from GreenApi.__init__ in API.py):

KwargDefaultMeaning
debug_modeFalseVerbose request logging
raise_errorsFalseRaise GreenAPIError on failures
hosthttps://api.green-api.comAPI host (apiUrl)
mediahttps://media.green-api.comMedia host for uploads
host_timeout180Seconds per host request retry
media_timeout10800Seconds per media request

Aliases: API.GreenAPI is the same class as API.GreenApi.

Partner API (separate client):

python
partner = API.GreenApiPartner(partnerToken="PARTNER_TOKEN")
# then: partner.partner.getInstances() / createInstance / deleteInstanceAccount
Response object

Every API method returns whatsapp_api_client_python.response.Response:

AttributeWhenContent
codealwaysHTTP status, or None on transport failure
datacode == 200Parsed JSON (dict / list)
errornon-200Response body text

Always check response.code == 200 before reading response.data.

Async

Most groups expose *Async twins (sendMessageAsync, receiveNotificationAsync, …). Call them with await inside asyncio.

chatId and phone format

Docs: https://green-api.com/en/docs/api/chat-id/

KindFormatExample
Personal chat<phone>@c.us79876543210@c.us
Group chat...@g.us120363043968066561@g.us
Lid...@lidreturned by API; do not invent
  • Phone: full international number, digits only, no +, spaces, or leading zeros tricks.
  • Never hand-craft group IDs — take them from createGroup, journals, or notifications.
  • Wrong chatId → validation 400: must be phone_number@c.us or group_id@g.us.

Instance must be authorized

Docs: https://green-api.com/en/docs/api/account/GetStateInstance/

Before sending, verify:

python
state = greenAPI.account.getStateInstance()
print(state.data)  # expect {"stateInstance": "authorized"}

Important states: authorized, notAuthorized, blocked, starting, suspended. Authorize via console QR / account.qr() / account.getAuthorizationCode(phoneNumber). Messages sit in the send queue up to 24 hours until the instance is authorized.

Message sending delay

Docs: https://green-api.com/en/docs/api/send-messages-delay/

Outgoing messages go through a FIFO queue. Delay is controlled by instance setting delaySendMessagesMilliseconds (min 500 ms, max 600000 ms; recommend ≤ 300000):

python
greenAPI.account.setSettings({"delaySendMessagesMilliseconds": 5000})

Note: setSettings reboots the instance; settings apply within ~5 minutes.

Typical scenarios

1. Send a text message

Docs: https://green-api.com/en/docs/api/sending/SendMessage/

python
from whatsapp_api_client_python import API

greenAPI = API.GreenAPI(id_instance, api_token)

response = greenAPI.sending.sendMessage(
    "79876543210@c.us",
    "Hello from GREEN-API",
    typingTime=3000,  # optional: 1000–20000 ms typing indicator
)

if response.code == 200:
    print(response.data["idMessage"])
else:
    print(response.error)

Required: chatId, message (max 20000 chars). Optional in SDK: quotedMessageId, archiveChat, linkPreview, typingTime, typePreview, customPreview. Response: { "idMessage": "..." }.

2. Send a file by URL

Docs: https://green-api.com/en/docs/api/sending/SendFileByUrl/

python
response = greenAPI.sending.sendFileByUrl(
    "79876543210@c.us",
    "https://download.samplelib.com/png/sample-clouds2-400x300.png",
    "sample-clouds2-400x300.png",
    "Caption text",
)

Required: chatId, urlFile, fileName (with extension). Max file size 100 MB.

3. Send a file by upload (local path)

Docs: https://green-api.com/en/docs/api/sending/SendFileByUpload/
Uses media host (SDK sets this automatically).

python
response = greenAPI.sending.sendFileByUpload(
    "79876543210@c.us",
    "data/logo.jpg",
    "logo.jpg",
    "Available rates",
)
# response.data: idMessage, urlFile (link valid 15 days)

SDK signature: sendFileByUpload(chatId, path, fileName=None, caption=None, ...). The local path is the second argument (path), not a raw file object.

4. Receive notifications — polling (built-in)

Docs: https://green-api.com/en/docs/api/receiving/technology-http-api/ReceiveNotification/

Requirement: instance webhookUrl must be empty. If a custom webhook URL is set, receiveNotification returns an error telling you to clear it.

python
from whatsapp_api_client_python import API

greenAPI = API.GreenAPI(id_instance, api_token)


def on_event(type_webhook: str, body: dict) -> None:
    if type_webhook == "incomingMessageReceived":
        chat_id = body["senderData"]["chatId"]
        msg = body["messageData"]
        if msg.get("typeMessage") == "textMessage":
            text = msg["textMessageData"]["textMessage"]
            print(chat_id, text)


# Blocks; Ctrl+C to stop. Internally: receiveNotification → handler → deleteNotification
greenAPI.webhooks.startReceivingNotifications(on_event)

Handler signature is fixed: (typeWebhook: str, body: dict). After handling, the SDK deletes the notification by receiptId (do not skip this if you poll manually).

Manual poll loop:

python
resp = greenAPI.receiving.receiveNotification(receiveTimeout=5)
if resp.code == 200 and resp.data:
    receipt_id = resp.data["receiptId"]
    body = resp.data["body"]
    # ... process body["typeWebhook"] ...
    greenAPI.receiving.deleteNotification(receipt_id)

receiveTimeout: 5–60 seconds (API default 5). Empty queue → empty body / no data. Notifications live in the queue 24 hours, FIFO.

Show full SKILL.md (390 more words)Show less
5. Receive notifications — webhook endpoint (your HTTP server)

Docs: https://green-api.com/en/docs/api/receiving/technology-webhook-endpoint/

This SDK does not ship a webhook HTTP server. Configure the instance, then run your own endpoint that accepts POST JSON and returns 200:

python
greenAPI.account.setSettings({
    "webhookUrl": "https://your.public.host/webhook",
    "webhookUrlToken": "Bearer your-secret",  # optional; see docs for Basic/Bearer
    "incomingWebhook": "yes",
    "outgoingWebhook": "yes",
    "outgoingAPIMessageWebhook": "yes",
    "stateWebhook": "yes",
})

GREEN-API POSTs notification JSON to webhookUrl. Retries every ~1 minute; guaranteed within 24 hours. While webhookUrl is set, polling will not receive those notifications.

Common typeWebhook values: incomingMessageReceived, outgoingMessageReceived, outgoingAPIMessageReceived, outgoingMessageStatus, stateInstanceChanged, statusInstanceChanged, incomingCall, outgoingCall, quotaExceeded, … Full list: https://green-api.com/en/docs/api/receiving/notifications-format/type-webhook/

6. Create a group and message it

Docs: https://green-api.com/en/docs/api/groups/CreateGroup/

python
created = greenAPI.groups.createGroup("Group Name", ["79876543210@c.us"])
if created.code == 200 and created.data.get("created"):
    chat_id = created.data["chatId"]  # ...@g.us
    greenAPI.sending.sendMessage(chat_id, "Hello group")

Do not create groups faster than about 1 per 5 minutes (anti-spam). Invalid numbers can get the sender blocked.

API surface map (SDK attributes)

Access as greenAPI.<group>.<method>(...).

AttributeClassReference
accountAccountreferences/account.md
sendingSendingreferences/sending.md
receivingReceivingreferences/receiving.md
webhooksWebhooksreferences/receiving.md
groupsGroupsreferences/groups.md
journalsJournalsreferences/journals.md
queuesQueuesreferences/queues.md
serviceMethodsServiceMethodsreferences/service-methods.md
markingMarkingreferences/marking.md
contactsContactsreferences/contacts.md
statusesStatusesreferences/statuses.md
deviceDevicereferences/device.md
partnerPartneronly on GreenApiPartner — references/partner.md

Full method list + signatures: references/inventory.md.

Pitfalls (read before coding)

  1. chatId format — personal phone@c.us, group id@g.us. No + in the phone part.
  2. Authorized instance — getStateInstance must be authorized for delivery.
  3. Polling vs webhook — mutually exclusive for the same traffic: clear webhookUrl for HTTP API polling; set webhookUrl for push.
  4. Always deleteNotification after processing a polled notification, or the same event will be returned forever.
  5. Sending delay — use delaySendMessagesMilliseconds ≥ 500 ms; bulk blasts without delay risk limits / bans.
  6. File size — max 100 MB; sendFileByUpload goes to media.green-api.com.
  7. Response handling — use response.data only when response.code == 200.
  8. Deprecated sending APIs still in SDK but marked deprecated: sendButtons, sendTemplateButtons, sendListMessage, sendLink — prefer sendInteractiveButtons / sendInteractiveButtonsReply / sendMessage.
  9. serviceMethods attribute name — camelCase serviceMethods, not service.
  10. Partner methods require GreenApiPartner, not GreenAPI.
  11. Groups rate limit — create groups slowly; non-existent numbers are dangerous.
  12. Hosts — default api.green-api.com / media.green-api.com; some accounts use instance-specific hosts from console — pass host= / media= if console shows them.

Agent checklist

When writing code for the user:

  • Import from whatsapp_api_client_python import API
  • Init API.GreenAPI(idInstance, apiTokenInstance) with real or env credentials
  • Use only methods from references/inventory.md
  • Format chatId as @c.us / @g.us
  • Check response.code before response.data
  • For receive: either polling (startReceivingNotifications / manual receive+delete) or webhook endpoint + setSettings, not a fictional SDK method
  • Prefer reading the matching references/*.md file for parameters before coding
  • Prefer official docs URL from the method docstring when unsure about edge cases

© green-api, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 13 other files (references) in skills of green-api/whatsapp-api-client-python.

  • SKILL.md
  • references/account.md
  • references/contacts.md
  • references/device.md
  • references/groups.md
  • references/inventory.md
  • references/journals.md
  • references/marking.md
  • references/partner.md
  • references/queues.md
  • references/receiving.md
  • references/sending.md
  • references/service-methods.md
  • references/statuses.md

Open the folder on GitHubat commit f84f9ab

Compare with similar skills

Greenapi Client Python next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Greenapi Client Python compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Greenapi Client Python this skillgreen-api/whatsapp-api-client-python209—~3.3kAutomated safety check: PassMIT
SetupRich627/whatsapp-claude-plugin101—~1.4kAutomated safety check: NotesApache-2.0
Discord Bot Architectdavila7/claude-code-templates32k6 repos~2kAutomated safety check: PassMIT
Instagramsickn33/agentic-awesome-skills47k2 repos~3.4kAutomated safety check: PassMIT
Create Experkfly/ex-skill2.5k—~3.7kAutomated safety check: NotesMIT
Integrate Whatsappgokapso/agent-skills175—~4.8kAutomated safety check: PassNone

Similar skills

  • Setup

    Rich627/whatsapp-claude-plugin

    Interactive WhatsApp channel onboarding — guides through device linking, phone number config, and access control setup

    101 GitHub stars~1.4k tokensUpdated 2 days ago
    Productivity & AutomationAuto-check: notes
  • Discord Bot Architect

    davila7/claude-code-templates

    Specialized skill for building production-ready Discord bots.

    32k GitHub starsUsed in 6 repos~2k tokens
    Productivity & AutomationAuto-check passed
  • Instagram

    sickn33/agentic-awesome-skills

    Integracao completa com Instagram via Graph API. An agent skill from sickn33/agentic-awesome-skills.

    47k GitHub starsUsed in 2 repos~3.4k tokens
    Productivity & AutomationAuto-check passed
  • Create Ex

    perkfly/ex-skill

    Distill an ex-girlfriend into an AI Skill. An agent skill from perkfly/ex-skill.

    2.5k GitHub stars~3.7k tokensUpdated 6 mo ago
    Productivity & AutomationAuto-check: notes
  • Integrate Whatsapp

    gokapso/agent-skills

    Connect WhatsApp to your product with Kapso: onboard customers with setup links, detect connections, receive events via webhooks, and send messages/templates/media.

    175 GitHub stars~4.8k tokensUpdated today
    Backend & APIsAuto-check passed
  • Wechat Automation

    LAVARONG/wechat-automation-api

    微信发信能力:通过 Windows 桌面微信发送文本、图片URL或本地文件。适合各类 Agent 在本机直接发送一次性消息。触发词:给[某人]发微信、通知[某人]、把这个用微信发给[某人]、用微信发个图片、把本地文件发给[某人]

    178 GitHub stars~1.2k tokensUpdated 19 days ago
    Productivity & AutomationAuto-check passed

Works with

Questions about Greenapi Client Python

What does Greenapi Client Python do?

Write correct Python code with the official GREEN-API SDK whatsapp-api-client-python (package whatsappapiclientpython). Greenapi Client Python is an agent skill from green-api/whatsapp-api-client-python. Write correct Python code with the official GREEN-API SDK whatsapp-api-client-python (package whatsappapiclientpython).

When should I use Greenapi Client Python?

Greenapi Client Python fits situations like: sending/receiving WhatsApp messages; partner instances; polling notifications; configuring a GREEN-API instance in Python.

How do I install Greenapi Client Python in Claude Code?

Run `npx skills add green-api/whatsapp-api-client-python --skill greenapi-client-python -a claude-code`. Or copy the skill folder (skills in green-api/whatsapp-api-client-python) into .claude/skills/greenapi-client-python in your project. Claude Code loads it when a task matches its description.

How do I install Greenapi Client Python in Codex?

Run `npx skills add green-api/whatsapp-api-client-python --skill greenapi-client-python -a codex`. Or copy the skill folder (skills in green-api/whatsapp-api-client-python) into .agents/skills/greenapi-client-python in your project. Codex loads it when a task matches its description.

Can I use Greenapi Client Python in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add green-api/whatsapp-api-client-python --skill greenapi-client-python -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/greenapi-client-python, .gemini/skills/greenapi-client-python, .github/skills/greenapi-client-python and .opencode/skills/greenapi-client-python in your project.

What does Greenapi Client Python need to run?

Going by SKILL.md and its folder, Greenapi Client Python needs the command-line tools its instructions call (python) and credentials named PARTNER_TOKEN. Our summary lists: Python 3; A credential in PARTNER_TOKEN.

Does Greenapi Client Python access the network?

SKILL.md names 5 domains. In commands or code: api.green-api.com, media.green-api.com and download.samplelib.com; the agent is likely to contact these when it follows the instructions. As links in the text: green-api.com and console.green-api.com. This is read from the text; nothing was executed.

Is Greenapi Client Python safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Greenapi Client Python use?

Greenapi Client Python is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Greenapi Client Python use?

About 3.3k tokens (SKILL.md is roughly 13k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 8.3k tokens, read only when the agent opens those files.

What are the alternatives to Greenapi Client Python?

Skills that share tags, products or a category with Greenapi Client Python: Setup (Rich627/whatsapp-claude-plugin, 101 stars), Discord Bot Architect (davila7/claude-code-templates, 32k stars), Instagram (sickn33/agentic-awesome-skills, 47k stars) and Create Ex (perkfly/ex-skill, 2.5k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Greenapi Client Python?

green-api (a GitHub organization) maintains it in green-api/whatsapp-api-client-python, which has 209 GitHub stars. The repository was last updated on October 1, 2026.

Source: green-api/whatsapp-api-client-python on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.