Poke.com Developer SDK
Project description
poke
The official Poke Python SDK for sending messages to your Poke agent, creating webhook triggers, and firing webhooks.
Built by Interaction Company in California.
Installation
pip install poke
Zero dependencies. Works with Python 3.8+.
Quick start
from poke import Poke
client = Poke(api_key="pk_...")
# Send a message to your agent
client.send_message("Summarize my unread emails")
# Create a webhook trigger
webhook = client.create_webhook(
condition="When a deploy fails",
action="Send me a summary of the error",
)
# Fire the webhook with data
client.send_webhook(
webhook_url=webhook["webhookUrl"],
webhook_token=webhook["webhookToken"],
data={"event": "deploy_failed", "repo": "my-app", "error": "OOM killed"},
)
Authentication
The SDK resolves credentials in this order:
api_keypassed to the constructorPOKE_API_KEYenvironment variable- Credentials from
poke login(~/.config/poke/credentials.json)
# Option 1: Pass directly
client = Poke(api_key="pk_...")
# Option 2: Set POKE_API_KEY in your environment
client = Poke()
# Option 3: Run `poke login` first, then
client = Poke()
Get your API key at poke.com/kitchen/api-keys.
Methods
client.send_message(message)
Send a text message to your Poke agent.
result = client.send_message("What meetings do I have today?")
# {"success": True, "message": "..."}
client.create_webhook(condition, action)
Create a webhook trigger. Returns a webhookUrl and webhookToken that you use with send_webhook.
webhook = client.create_webhook(
condition="When a new user signs up",
action="Send me a welcome summary in Slack",
)
# {
# "triggerId": "...",
# "webhookUrl": "https://poke.com/api/v1/inbound/webhook",
# "webhookToken": "eyJhbG..."
# }
client.send_webhook(webhook_url, webhook_token, data)
Fire a webhook trigger with data. Use the webhook_url and webhook_token returned by create_webhook.
client.send_webhook(
webhook_url=webhook["webhookUrl"],
webhook_token=webhook["webhookToken"],
data={"event": "new_signup", "email": "user@example.com", "plan": "pro"},
)
# {"success": True}
Configuration
| Option | Environment Variable | Default |
|---|---|---|
api_key |
POKE_API_KEY |
— |
base_url |
POKE_API |
https://poke.com/api/v1 |
Error handling
from poke import Poke, AuthenticationError, ForbiddenError, RateLimitError, PokeError
client = Poke()
try:
client.send_message("hello")
except AuthenticationError:
print("Bad API key")
except ForbiddenError:
print("Key lacks required scopes")
except RateLimitError:
print("Slow down")
except PokeError as e:
print(f"API error ({e.status}): {e}")
Configuration
Credentials are stored in ~/.config/poke/credentials.json (respects $XDG_CONFIG_HOME).
| Environment Variable | Description | Default |
|---|---|---|
POKE_API_KEY |
API key for SDK usage | — |
POKE_API |
API base URL | https://poke.com/api/v1 |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file poke-0.1.1.tar.gz.
File metadata
- Download URL: poke-0.1.1.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2650e01bbcdff40c358e589afd71951ce8fb28353e84477493b863510505c25f
|
|
| MD5 |
5a4909688695e38c333efffbda7acd16
|
|
| BLAKE2b-256 |
91d986e5bb3c77ae4bef9cd2600f3e8061b29a886d8797fb345a2b280d06d76b
|
File details
Details for the file poke-0.1.1-py3-none-any.whl.
File metadata
- Download URL: poke-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bdb3f9a53376656389d4246fcd663ad2fd9f3d70081f30a1be7455b39b32410
|
|
| MD5 |
7e20e756a982b89bc0c76008195d242e
|
|
| BLAKE2b-256 |
4b88a4e0f4e978893dd510ed8c6b77434050c6d4a49ebe212fb50c03c70fa42f
|