{"id":224,"library":"trycourier","title":"Courier (trycourier)","description":"Python SDK for Courier notification API (multi-channel: email, SMS, push, in-app). Current version is 7.9.0. Install name is trycourier (pip install trycourier) but import name changed to courier in v5+ (from courier.client import Courier). The SDK was completely rewritten with Fern code generation in v5, breaking all v4 code.","status":"active","version":"7.9.0","language":"python","source_language":"en","source_url":"https://github.com/trycourier/courier-python","tags":["notifications","email","sms","push","multi-channel","in-app"],"install":[{"cmd":"pip install trycourier","lang":"bash","label":"Standard (note: import name is courier, not trycourier)"}],"dependencies":[{"reason":"Required. Installed automatically.","package":"httpx","optional":false},{"reason":"Required. Installed automatically.","package":"pydantic","optional":false}],"imports":[{"note":"Install with pip install trycourier but import from courier (not trycourier). v4 used from trycourier import Courier with auth_token= and event/recipient params. v5+ uses from courier.client import Courier with authorization_token= and structured message objects.","wrong":"# Old v4 import pattern (broken in v5+):\nfrom trycourier import Courier\nclient = Courier(auth_token='YOUR_TOKEN')\nclient.send(\n    event='notification-id',\n    recipient='recipient-id',\n    data={'name': 'Alice'}\n)","symbol":"Courier","correct":"# Current v5+ API (import from courier, not trycourier)\nfrom courier.client import Courier\nimport courier\n\nclient = Courier(authorization_token='YOUR_COURIER_AUTH_TOKEN')\n\nresponse = client.send(\n    message=courier.ContentMessage(\n        to=courier.UserRecipient(email='user@example.com'),\n        content=courier.ElementalContent(\n            version='2020-01-01',\n            elements=[courier.ElementalNode_Text(content='Hello!')]\n        ),\n        routing=courier.Routing(method='all', channels=['email'])\n    )\n)\nprint(response.request_id)"}],"quickstart":{"code":"# pip install trycourier\nfrom courier.client import Courier\nimport courier\n\nclient = Courier(\n    authorization_token='YOUR_COURIER_AUTH_TOKEN'\n    # or set env var COURIER_AUTH_TOKEN\n)\n\n# Send using a template (workflow)\nresponse = client.send(\n    message=courier.TemplateMessage(\n        template='your-template-id',  # template ID from Courier dashboard\n        to=courier.UserRecipient(\n            email='user@example.com',\n            user_id='user-123'\n        ),\n        data={\n            'name': 'Alice',\n            'action_url': 'https://yourapp.com'\n        }\n    )\n)\nprint('Request ID:', response.request_id)\n\n# Async client\nfrom courier.client import AsyncCourier\nimport asyncio\n\nasync def send():\n    async with AsyncCourier(authorization_token='YOUR_TOKEN') as client:\n        await client.send(message=courier.TemplateMessage(\n            template='your-template-id',\n            to=courier.UserRecipient(email='user@example.com')\n        ))\n\nasyncio.run(send())","lang":"python","description":"v5+ API. Install is trycourier, import is courier. Sync and async clients available."},"warnings":[{"fix":"pip install trycourier then import from courier: from courier.client import Courier","message":"Install name (trycourier) and import name (courier) differ since v5. pip install trycourier then from courier.client import Courier. LLMs frequently generate from trycourier import Courier which raises ImportError on v5+.","severity":"breaking","affected_versions":">= 5.0"},{"fix":"Migrate to: from courier.client import Courier; client = Courier(authorization_token=...); client.send(message=courier.TemplateMessage(template=..., to=courier.UserRecipient(...)))","message":"Complete API rewrite in v5 using Fern code generation. v4 API (Courier(auth_token=), client.send(event=, recipient=, data=)) is completely gone. All v4 code raises ImportError or AttributeError on v5+.","severity":"breaking","affected_versions":">= 5.0"},{"fix":"Replace Courier(auth_token='...') with Courier(authorization_token='...') or set COURIER_AUTH_TOKEN env var.","message":"auth_token= parameter renamed to authorization_token= in v5. Passing auth_token= raises TypeError.","severity":"breaking","affected_versions":">= 5.0"},{"fix":"Use resource-scoped API: client.brands.delete(...), client.lists.get(...), etc.","message":"Resource-scoped methods introduced in v5. Old flat methods like courier.deleteBrands() replaced with courier.brands.delete(). All flat method calls raise AttributeError.","severity":"breaking","affected_versions":">= 5.0"},{"fix":"Set COURIER_AUTH_TOKEN in your environment, or pass authorization_token= explicitly. Verify with: python -c \"import os; print(os.environ.get('COURIER_AUTH_TOKEN'))\"","message":"The COURIER_AUTH_TOKEN environment variable is read automatically if authorization_token= is not passed. Useful for 12-factor apps but can cause silent auth failures if the wrong env var is set.","severity":"gotcha","affected_versions":">= 5.0"}],"env_vars":null,"search_vec":"'7.9.0':21 'api':8 'app':17,65 'break':52 'chang':32 'channel':11,62 'code':48,55 'complet':44 'courier':1,6,34,40 'courier.client':38 'current':18 'email':12,57 'fern':47 'generat':49 'import':30,39 'in-app':15,63 'instal':22,27 'multi':10,61 'multi-channel':9,60 'name':23,31 'notif':7,56 'pip':26 'push':14,59 'python':3 'rewritten':45 'sdk':4,42 'sms':13,58 'trycouri':2,25,28 'v4':54 'v5':36,51 'version':19","created_at":"2026-03-27T04:46:56.869275+00:00","updated_at":"2026-04-16T23:21:34.681557+00:00","problems":{"verify_error":"no import statement found"},"ecosystem":"pypi","meta_description":null,"install_score":80,"quickstart_score":0,"quickstart_tag":"stale","pypi_latest":"9.2.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://www.courier.com","github":"https://github.com/trycourier/courier-python","docs":null,"changelog":null,"pypi":"https://pypi.org/project/trycourier/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["communication","http-networking"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-27","next_check":"2026-07-05","install_tag":"verified"}}