Documentation Index
Fetch the complete documentation index at: https://docs.mailglyph.com/llms.txt
Use this file to discover all available pages before exploring further.
Use a public key for tracking events, and a secret key for listing event names.
Track an event (events.track)
from mailglyph import MailGlyph
tracker = MailGlyph("pk_your_public_key")
result = tracker.events.track(
email="[email protected]",
event="purchase",
subscribed=True,
data={"product": "premium", "amount": 99},
)
print(result.contact, result.event, result.timestamp)
List event names (events.get_names)
from mailglyph import MailGlyph
client = MailGlyph("sk_your_secret_key")
event_names = client.events.get_names()
print(event_names)
Key-type mismatch example
from mailglyph import MailGlyph
from mailglyph.exceptions import AuthenticationError
client = MailGlyph("pk_your_public_key")
try:
client.events.get_names()
except AuthenticationError as error:
print(error.message)
Async equivalents
from mailglyph import AsyncMailGlyph
async def run() -> None:
async with AsyncMailGlyph("pk_your_public_key") as tracker:
result = await tracker.events.track(email="[email protected]", event="signup")
print(result.event)
async with AsyncMailGlyph("sk_your_secret_key") as client:
names = await client.events.get_names()
print(names)
The Python SDK exposes events.get_names() only (there is no list_names() alias).
See endpoint details in the Track event API reference and List event names API reference.