blueping 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- blueping-2.0.0/.gitignore +11 -0
- blueping-2.0.0/LICENSE +21 -0
- blueping-2.0.0/PKG-INFO +361 -0
- blueping-2.0.0/README.md +333 -0
- blueping-2.0.0/pyproject.toml +62 -0
- blueping-2.0.0/src/blueping/__init__.py +175 -0
- blueping-2.0.0/src/blueping/__main__.py +4 -0
- blueping-2.0.0/src/blueping/_client.py +1143 -0
- blueping-2.0.0/src/blueping/_config.py +118 -0
- blueping-2.0.0/src/blueping/_dates.py +12 -0
- blueping-2.0.0/src/blueping/_errors.py +75 -0
- blueping-2.0.0/src/blueping/_http.py +198 -0
- blueping-2.0.0/src/blueping/_login.py +167 -0
- blueping-2.0.0/src/blueping/_version.py +1 -0
- blueping-2.0.0/src/blueping/_webhooks.py +101 -0
- blueping-2.0.0/src/blueping/cli.py +505 -0
- blueping-2.0.0/src/blueping/py.typed +0 -0
- blueping-2.0.0/src/blueping/skills/blueping/SKILL.md +103 -0
- blueping-2.0.0/src/blueping/types.py +934 -0
- blueping-2.0.0/tests/conftest.py +178 -0
- blueping-2.0.0/tests/test_cli.py +851 -0
- blueping-2.0.0/tests/test_client.py +340 -0
- blueping-2.0.0/tests/test_mail.py +490 -0
- blueping-2.0.0/tests/test_skill.py +26 -0
- blueping-2.0.0/tests/test_webhooks.py +156 -0
blueping-2.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Blueping
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
blueping-2.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: blueping
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Email inboxes for AI agents: the Blueping client for Python. One call gives an agent its own inbox; read mail as JSON, wait for verification codes (OTP), send and reply. Typed, with no dependencies.
|
|
5
|
+
Project-URL: Homepage, https://blueping.dev
|
|
6
|
+
Project-URL: Documentation, https://blueping.dev/docs
|
|
7
|
+
Project-URL: Changelog, https://blueping.dev/changelog
|
|
8
|
+
Project-URL: Issues, https://blueping.dev/support
|
|
9
|
+
Author: Blueping
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: agent-email,agent-inbox,agent-skills,ai-agent-email,ai-agents,blueping,email,email-api,email-for-ai-agents,email-inbox,email-to-json,inbound-email,inbox,mcp,otp,verification-code,webhooks
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Topic :: Communications :: Email
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
|
+
Classifier: Typing :: Typed
|
|
26
|
+
Requires-Python: >=3.9
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# Blueping for Python
|
|
30
|
+
|
|
31
|
+
[Blueping](https://blueping.dev) gives your AI agent its own email inbox in one API call: `username@blueping.dev`, receiving at once. Every message arrives as clean JSON, with the sender's new words, verification codes (OTP) and links pulled out, attachments readable as text, and a verdict on who sent it and what it says.
|
|
32
|
+
|
|
33
|
+
This package has no dependencies and runs on Python 3.9 and later. It gives you typed responses, safe retries, webhook verification, and a small CLI that gets you an API key from your terminal.
|
|
34
|
+
|
|
35
|
+
## Email inboxes for agents
|
|
36
|
+
|
|
37
|
+
An agent can have its own inbox, `username@blueping.dev`, in one call, with no key and no person to start: `Blueping.signup()` makes the agent, its key and its first inbox, which receives at once.
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from blueping import Blueping
|
|
41
|
+
|
|
42
|
+
signed = Blueping.signup(name="Acme Support", owner_email="you@acme.com")
|
|
43
|
+
# Keep signed["api_key"]: this is the only answer that shows it.
|
|
44
|
+
client, inbox = signed.client, signed["inbox"]
|
|
45
|
+
|
|
46
|
+
# Sign up to a service with inbox["address"], then wait for its code or its sign-in link.
|
|
47
|
+
found = client.wait_for_code(inbox["id"], from_="service.example")
|
|
48
|
+
print(found["code"], found["link"])
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Until a person claims the agent, it writes only to people who wrote to it first, and to `echo@blueping.dev`, which answers within seconds with a test code. The owner gets a 6-digit code by email, and `client.verify_signup(code)` claims the agent.
|
|
52
|
+
|
|
53
|
+
With a key from your dashboard, `Blueping()` reads `BLUEPING_API_KEY`, and each agent gets as many inboxes as its plan holds:
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
blueping = Blueping()
|
|
57
|
+
support = blueping.inboxes.create("acme-support", display_name="Acme Support", client_id="support")
|
|
58
|
+
print(support["address"]) # acme-support@blueping.dev
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
page = client.inboxes.list_messages(inbox["id"], wait=30)
|
|
63
|
+
print(page["held"]) # what was kept back and why: include_held=True lists it
|
|
64
|
+
client.messages.reply(page["data"][0]["id"], "Thanks, received.")
|
|
65
|
+
client.inboxes.send(inbox["id"], "ana@example.com", "Your invoice", "Attached.", attachments=[{"filename": "invoice.pdf", "content_type": "application/pdf", "content": pdf_bytes}])
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The rest of the mailbox works the same way:
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from datetime import datetime, timedelta, timezone
|
|
72
|
+
|
|
73
|
+
email = page["data"][0]
|
|
74
|
+
client.messages.forward(email["id"], "accounting@acme.com", text="For the books.")
|
|
75
|
+
client.messages.label(email["id"], add=["invoices"])
|
|
76
|
+
text = client.messages.attachment_text(email["id"], email["attachments"][0]["id"])["text"] # what the file says
|
|
77
|
+
client.drafts.create(inbox["id"], to="ana@acme.com", subject="Reminder", text="Tomorrow at 9.", send_at=datetime.now(timezone.utc) + timedelta(hours=1))
|
|
78
|
+
client.rules.add(inbox["id"], "receive", "block", "@spam.example")
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`client.inboxes.list_threads()` and `client.threads` read and label conversations, `client.drafts` writes, schedules and sends drafts, and `client.rules` keeps each inbox's allow and block lists.
|
|
82
|
+
|
|
83
|
+
Every email carries `auth` (SPF, DKIM and DMARC, with a verdict) and `safety` (text aimed at a model, hidden text). A message whose sender failed authentication, or that carries instructions for a model, is held: lists count it in `held`, and `include_held=True` shows it. Every send, forward and new draft carries an `Idempotency-Key`, so a retry sends or writes once. `client.me.limits()` says what the agent may send now, with `warnings` from 80% of a limit.
|
|
84
|
+
|
|
85
|
+
### A send that meets a limit waits
|
|
86
|
+
|
|
87
|
+
A send past a limit that only takes time, such as the plan's day or month or the ramp of new recipients, is never refused for it: it comes back with `status` `"queued"`, `sends_at` and `reason`, and goes out by itself at `sends_at`, with every check run again. Every send's answer reads its `Blueping-Usage` header for you, in `usage`.
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
sent = client.inboxes.send(inbox["id"], "ana@example.com", "Your invoice", "Attached.")
|
|
91
|
+
if sent["status"] == "queued":
|
|
92
|
+
print(f"goes at {sent['sends_at']}, waiting for {sent['reason']}")
|
|
93
|
+
print(sent.get("usage")) # {"day": {"used": 42, "allowed": 100}, "month": {"used": 1200, "allowed": 3000}}
|
|
94
|
+
|
|
95
|
+
# Refused instead of queued, for code that decides itself: raises daily_limit_reached and the others.
|
|
96
|
+
client.inboxes.send(inbox["id"], "ana@example.com", "Now or never", "Hi", if_limited="refuse")
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Email plans
|
|
100
|
+
|
|
101
|
+
| Plan | Price | Inboxes | Emails sent a month | A day |
|
|
102
|
+
| --- | --- | --- | --- | --- |
|
|
103
|
+
| Free | $0 | 3 | 3,000 | 100 |
|
|
104
|
+
| Developer | $19 a month, or $180 a year | 50 | 15,000 | 1,500 |
|
|
105
|
+
| Startup | $79 a month, or $780 a year | 500 | 75,000 | 7,500 |
|
|
106
|
+
| Scale | $249 a month, or $2,484 a year | 5,000 | 300,000 | 30,000 |
|
|
107
|
+
|
|
108
|
+
Mail the agent receives never counts as a send: the plan's storage is what holds it. On Free, mail the agent sends ends with a short "Sent with Blueping" line; paid plans add nothing. `client.me.mail_plan_checkout("developer", period="year")` answers a payment page for the agent's owner to open in their own browser. Every limit: [blueping.dev/pricing](https://blueping.dev/pricing).
|
|
109
|
+
|
|
110
|
+
### Many inboxes, delivery and events
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
# One inbox per customer, up to 50 in one call: the same client_id twice makes nothing twice.
|
|
114
|
+
batch = client.inboxes.create_many([{"username": "acme-1", "client_id": "cust_1"}, {"username": "globex", "client_id": "cust_2"}])
|
|
115
|
+
for inbox in client.inboxes.iterate(): # page after page
|
|
116
|
+
print(inbox["address"])
|
|
117
|
+
|
|
118
|
+
health = client.inboxes.deliverability(inbox["id"], days=30) # delivered, bounced, complaints, what to do
|
|
119
|
+
entries = client.suppressions.list() # the addresses nothing more goes to
|
|
120
|
+
|
|
121
|
+
for event in client.events.iterate(types=["email.received", "email.bounced"]): # as it happens, kept 7 days
|
|
122
|
+
print(event["type"], event["data"])
|
|
123
|
+
|
|
124
|
+
found = client.search("invoice november", has_attachment=True) # every inbox: the text, and on a paid plan the files
|
|
125
|
+
month = client.usage.get(month="2026-11")
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
A key can be limited to one inbox and to permissions: a call past them raises `PermissionDenied` (with `required`) or `InboxOutOfScope` (with `key_inbox_id`), both a `BluepingError`. `client.messages.release(message_id)` lets a held message in, with a key that holds `held:release`. With an admin key, `BluepingOrg()` reads `BLUEPING_ADMIN_KEY` and creates agents and their keys: `org.agents.create()`, `org.keys.create()`, `org.audit.list()` and `org.usage()`. [Keys and permissions](https://blueping.dev/docs/keys).
|
|
129
|
+
|
|
130
|
+
## Install
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
pip install blueping
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Get an API key
|
|
137
|
+
|
|
138
|
+
Run the CLI:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
blueping login
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
It shows a link and a short code, and opens the link in your browser when it can. Sign in with Google, GitHub or your email, check that the page shows the same code and approve. The key is saved in `~/.config/blueping/config.json`, readable only by you, and never printed. No credit card. You can also [sign up on the website](https://blueping.dev/signup), copy the key from the dashboard and set it as `BLUEPING_API_KEY`.
|
|
145
|
+
|
|
146
|
+
An agent uses two steps instead, so it can show your user the link while it waits: `blueping login --start`, then `blueping login --check` until it prints `approved`. Without a terminal, or with `--json`, a plain `login` starts and returns the same way.
|
|
147
|
+
|
|
148
|
+
## Try it in a minute
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
from blueping import Blueping
|
|
152
|
+
|
|
153
|
+
blueping = Blueping() # reads BLUEPING_API_KEY
|
|
154
|
+
|
|
155
|
+
inbox = blueping.inboxes.create(client_id="first-try")
|
|
156
|
+
blueping.inboxes.send(inbox["id"], "echo@blueping.dev", "Hello", "Testing my inbox")
|
|
157
|
+
|
|
158
|
+
# echo@blueping.dev answers within seconds, with a test code.
|
|
159
|
+
found = blueping.wait_for_code(inbox["id"], from_="blueping.dev")
|
|
160
|
+
page = blueping.inboxes.list_messages(inbox["id"])
|
|
161
|
+
print(inbox["address"], found["code"], [message["subject"] for message in page["data"]])
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
`client_id` makes the create safe to run again: the same id returns the same inbox.
|
|
165
|
+
|
|
166
|
+
## Errors
|
|
167
|
+
|
|
168
|
+
Every API error raises `BluepingError` with `status`, `code`, `message` and `details`, which holds every extra field the API sent, `next_action` and `retry_after` included:
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
from blueping import Blueping, BluepingError
|
|
172
|
+
|
|
173
|
+
blueping = Blueping()
|
|
174
|
+
try:
|
|
175
|
+
blueping.inboxes.send(inbox_id, "ana@example.com", "Your invoice", "Attached.")
|
|
176
|
+
except BluepingError as error:
|
|
177
|
+
print(error.code, error.details.get("next_action")) # what to do now, written for an agent
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
| Code | Status | What it means |
|
|
181
|
+
| --- | --- | --- |
|
|
182
|
+
| `recipient_not_allowed` | 403 | Before a person claims the agent, it writes only to people who wrote to it first, to echo@blueping.dev and to its owner. |
|
|
183
|
+
| `message_held` | 403 | A held message isn't answered or forwarded: it waits for a person. |
|
|
184
|
+
| `recipient_blocked` | 403 | One of the inbox's own send rules refuses a recipient. |
|
|
185
|
+
| `inbox_limit_reached` | 429 | The plan's inboxes are all in use. |
|
|
186
|
+
| `queue_full` | 429 | The send met a limit and the queue is full. `retry_after` says when it has room. |
|
|
187
|
+
| `no_code_yet` | 404 | `wait_for_code` found no code in time. Call it again. |
|
|
188
|
+
| `too_many_recipients` | 400 | 10 addresses at most per message, to, cc and bcc together. |
|
|
189
|
+
| `attachments_too_large` | 413 | 10 MB of attachments per send. |
|
|
190
|
+
| `rate_limited` | 429 | Too many requests in a short time. Wait `details["retry_after"]` seconds. |
|
|
191
|
+
| `unauthorized` | 401 | The API key is wrong, or was revoked. |
|
|
192
|
+
| `internal_error` | 500 | Something failed on Blueping's side. The client already retried with the same key. |
|
|
193
|
+
|
|
194
|
+
When the API cannot be reached at all, the client raises `BluepingConnectionError`, a subclass of `BluepingError` with `status` 0 and `code` `"network_error"`. Every code, with what it means and what to do: [blueping.dev/docs/errors](https://blueping.dev/docs/errors).
|
|
195
|
+
|
|
196
|
+
## Retries and idempotency
|
|
197
|
+
|
|
198
|
+
The client retries any request that got no answer, and any 500, up to two times with a short backoff. Every send, reply, forward and new draft carries an `Idempotency-Key`, kept 24 hours, so a retried send never goes out twice. Pass your own key to make your own retries safe as well, for example when a job runs again:
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
blueping.messages.reply(message_id, "Invoice 1042 is scheduled for payment on December 1.", idempotency_key="invoice-1042-ack")
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Without a key, the same message to the same people from the same inbox within 5 minutes still goes once. You can also change the 30 second timeout, or turn retries off:
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
blueping = Blueping(timeout=10, max_retries=0)
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Webhooks
|
|
211
|
+
|
|
212
|
+
Blueping posts events to your URLs as they happen: `email.received` when mail reaches an inbox, `email.held` when it is kept back, `email.sent` when a send goes out, `email.delivered`, `email.deferred`, `email.bounced` and `email.complained` for each recipient, `email.suppressed` when an address joins the suppression list, `email.failed` when a send fails, `email.draft_failed` when a scheduled draft fails, and `test.ping` when you ask for a test. Each message event carries `data["inbox"]` and `data["message"]`.
|
|
213
|
+
|
|
214
|
+
An account has up to 10 webhooks, each with its own secret and the events it wants. Keep the secret the answer holds: no other answer shows it again. `email.held` needs a key that holds `held:read`.
|
|
215
|
+
|
|
216
|
+
```python
|
|
217
|
+
hook = blueping.webhooks.create("https://example.com/blueping", events=["email.received", "email.bounced"])
|
|
218
|
+
print(hook["secret"]) # whsec_..., store it as BLUEPING_WEBHOOK_SECRET
|
|
219
|
+
|
|
220
|
+
blueping.webhooks.test(hook["id"]) # sends a signed test.ping
|
|
221
|
+
print(blueping.webhooks.deliveries(hook["id"])["data"]) # the latest 50, with their status and last error
|
|
222
|
+
blueping.webhooks.update(hook["id"], enabled=False) # off for now
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Each event carries a `Blueping-Signature` header. `verify_webhook` checks it against the raw request body, refuses events signed more than five minutes ago so they cannot be replayed, and returns the event. It raises `WebhookVerificationError` when anything is off. Pass the body exactly as it arrived, before any JSON parsing, since parsing and serializing again changes the bytes.
|
|
226
|
+
|
|
227
|
+
### Flask
|
|
228
|
+
|
|
229
|
+
```python
|
|
230
|
+
import os
|
|
231
|
+
|
|
232
|
+
from flask import Flask, request
|
|
233
|
+
|
|
234
|
+
from blueping import Blueping, WebhookVerificationError, verify_webhook
|
|
235
|
+
|
|
236
|
+
app = Flask(__name__)
|
|
237
|
+
blueping = Blueping()
|
|
238
|
+
WEBHOOK_SECRET = os.environ["BLUEPING_WEBHOOK_SECRET"]
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
@app.post("/blueping")
|
|
242
|
+
def blueping_webhook():
|
|
243
|
+
try:
|
|
244
|
+
event = verify_webhook(
|
|
245
|
+
request.get_data(),
|
|
246
|
+
request.headers.get("Blueping-Signature"),
|
|
247
|
+
WEBHOOK_SECRET,
|
|
248
|
+
)
|
|
249
|
+
except WebhookVerificationError:
|
|
250
|
+
return "Invalid signature", 400
|
|
251
|
+
|
|
252
|
+
if event["type"] == "email.received":
|
|
253
|
+
message = event["data"]["message"]
|
|
254
|
+
print(f"{message['from']['address']} wrote: {message['subject']}")
|
|
255
|
+
blueping.messages.reply(message["id"], "Got it, thanks.", idempotency_key=event["id"])
|
|
256
|
+
return "", 204
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### FastAPI
|
|
260
|
+
|
|
261
|
+
```python
|
|
262
|
+
import os
|
|
263
|
+
|
|
264
|
+
from fastapi import FastAPI, HTTPException, Request, Response
|
|
265
|
+
|
|
266
|
+
from blueping import WebhookVerificationError, verify_webhook
|
|
267
|
+
|
|
268
|
+
app = FastAPI()
|
|
269
|
+
WEBHOOK_SECRET = os.environ["BLUEPING_WEBHOOK_SECRET"]
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
@app.post("/blueping")
|
|
273
|
+
async def blueping_webhook(request: Request) -> Response:
|
|
274
|
+
try:
|
|
275
|
+
event = verify_webhook(
|
|
276
|
+
await request.body(),
|
|
277
|
+
request.headers.get("blueping-signature"),
|
|
278
|
+
WEBHOOK_SECRET,
|
|
279
|
+
)
|
|
280
|
+
except WebhookVerificationError:
|
|
281
|
+
raise HTTPException(status_code=400, detail="Invalid signature")
|
|
282
|
+
|
|
283
|
+
if event["type"] == "email.received":
|
|
284
|
+
message = event["data"]["message"]
|
|
285
|
+
print(f"{message['from']['address']} wrote: {message['subject']}")
|
|
286
|
+
return Response(status_code=204)
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
Answer with a 2xx status within 10 seconds. Blueping retries failed deliveries for about 31 hours, so the same event can arrive more than once: use `event["id"]` to skip the ones you already handled.
|
|
290
|
+
|
|
291
|
+
### Testing your handler
|
|
292
|
+
|
|
293
|
+
`sign_webhook` builds a valid signature header, so your tests can post events to your own endpoint:
|
|
294
|
+
|
|
295
|
+
```python
|
|
296
|
+
import json
|
|
297
|
+
|
|
298
|
+
from blueping import sign_webhook
|
|
299
|
+
|
|
300
|
+
body = json.dumps({
|
|
301
|
+
"id": "evt_test",
|
|
302
|
+
"type": "test.ping",
|
|
303
|
+
"created_at": "2026-11-22T09:00:00.000Z",
|
|
304
|
+
"data": {},
|
|
305
|
+
}).encode()
|
|
306
|
+
|
|
307
|
+
response = test_client.post(
|
|
308
|
+
"/blueping",
|
|
309
|
+
content=body, # data=body with Flask's test client
|
|
310
|
+
headers={"Blueping-Signature": sign_webhook(body, WEBHOOK_SECRET)},
|
|
311
|
+
)
|
|
312
|
+
assert response.status_code == 204
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
## CLI
|
|
316
|
+
|
|
317
|
+
Installing the package also installs the `blueping` command. It is small: it gets your agent a key and says where the agent stands.
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
blueping login # get a key: approve this terminal in your browser
|
|
321
|
+
blueping login --start # for agents: print the link and the code, then return
|
|
322
|
+
blueping login --check # for agents: prints pending, approved, denied or expired
|
|
323
|
+
blueping whoami # which agent and which key this terminal uses
|
|
324
|
+
blueping limits # the plan, the claim, and what is left today and this month
|
|
325
|
+
blueping upgrade --plan developer # a payment page for the agent's owner: nothing is bought until they pay
|
|
326
|
+
blueping logout # delete the saved key
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
`blueping` alone signs you in the first time, then shows the plan, the claim, the inboxes and today's sends. `upgrade` takes `--plan developer|startup|scale` and `--period month|year`, and prints a Stripe page for the agent's owner to open in their own browser. Every command takes `--json`, and the CLI never prints a key. `BLUEPING_CLIENT` sets how the approval page names who asks, such as `Claude Code`. `python -m blueping` works too. Over SSH or in CI, `blueping login` doesn't open a browser: open its link on any device where you can sign in.
|
|
330
|
+
|
|
331
|
+
The full email CLI, with inboxes, mail, verification codes and sending, is `npx blueping`, from the Node.js package.
|
|
332
|
+
|
|
333
|
+
## Configuration
|
|
334
|
+
|
|
335
|
+
| Setting | Argument | Environment variable | Default |
|
|
336
|
+
| --- | --- | --- | --- |
|
|
337
|
+
| API key | `api_key` | `BLUEPING_API_KEY` | the key saved by `blueping login` |
|
|
338
|
+
| Base URL | `base_url` | `BLUEPING_BASE_URL` | the saved key's server, then `https://blueping.dev` |
|
|
339
|
+
|
|
340
|
+
Arguments win over environment variables, which win over the saved file.
|
|
341
|
+
|
|
342
|
+
## Use Blueping from Claude Code and other agents
|
|
343
|
+
|
|
344
|
+
An agent can make and read its own inbox. Paste this into it:
|
|
345
|
+
|
|
346
|
+
```text
|
|
347
|
+
Read https://blueping.dev/agent-onboarding.md and set yourself up with a Blueping inbox.
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Or add the hosted MCP server. There is nothing to install, and it signs in through the browser:
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
claude mcp add --transport http blueping https://blueping.dev/mcp
|
|
354
|
+
claude mcp login blueping
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Cursor, Codex, ChatGPT, a key instead of OAuth, the skill and the plugin: [blueping.dev/agents](https://blueping.dev/agents). LangChain, CrewAI, Pydantic AI, LlamaIndex and the other frameworks, set up in a few lines: [blueping.dev/integrations](https://blueping.dev/integrations).
|
|
358
|
+
|
|
359
|
+
## License
|
|
360
|
+
|
|
361
|
+
MIT
|