langchain-goodsender
LangChain tools for GoodSender — the free transactional email API with built-in consent management. Send OTP codes, MFA enrollment, new-device alerts, order confirmations, and more via predefined templates. Send custom/marketing email to recipients who have granted consent via the Permission Loop.
Install
pip install langchain-goodsender
Authentication
Set your API key as an environment variable:
export GOODSENDER_API_KEY="gs_..."
Or pass it directly:
from langchain_goodsender import GoodSenderToolkit
toolkit = GoodSenderToolkit(api_key="gs_...")
Get a free API key at goodsender.com — 100,000 emails/month free, no credit card required.
Quick start
from langchain_goodsender import GoodSenderToolkit
from langchain_openai import ChatOpenAI
toolkit = GoodSenderToolkit() # reads GOODSENDER_API_KEY
tools = toolkit.get_tools()
model = ChatOpenAI(model="gpt-4o").bind_tools(tools)
result = model.invoke("Send an OTP code 482193 to alice@example.com from noreply@myapp.com with app_name MyApp")
Tools
goodsender_send_template
Send a predefined transactional email instantly to any address — no recipient consent needed.
Available template_id values: mfa_enrollment, new_device_login, order_completed, otp_code, email_changed, password_changed, order_receipt.
goodsender_send_email
Send a custom email (markdown, HTML, or plain text).
Consent caveat: This endpoint is consent-gated. The recipient must have approved via the GoodSender Permission Loop before the email delivers. If the recipient has not granted consent, the send is silently filtered — the email is not delivered. Use
goodsender_request_consentfirst.
goodsender_request_consent
Ask one or more recipients to approve future custom/marketing email from your sending domain. GoodSender sends each recipient a consent request. Once they click approve, their status becomes granted and custom sends will deliver instantly.
Consent caveat
GoodSender has two sending paths:
| Path | Endpoint | Consent required? |
|---|---|---|
| Transactional templates | goodsender_send_template |
No — delivers instantly to any address |
| Custom/marketing email | goodsender_send_email |
Yes — recipient must have granted consent |
If your agent needs to send a custom email to a new recipient, it must first call goodsender_request_consent and wait for the recipient to approve. Transactional templates (otp_code, mfa_enrollment, etc.) bypass this entirely.
Template variables
Each template accepts optional string variables. All default to empty if omitted.
template_id |
Variables |
|---|---|
otp_code |
app_name, otp_code, expiry_minutes, purpose, anti_phishing_notice |
mfa_enrollment |
app_name, mfa_method, enrolled_at |
new_device_login |
app_name, login_time, additional_info |
order_completed |
app_name, order_id, order_total, completed_at |
order_receipt |
app_name, description, total, purchase_date, receipt_number, payment_method |
email_changed |
app_name, new_email, changed_at, additional_info |
password_changed |
app_name, changed_at, additional_info |
API Reference
Full docs: goodsender.com/docs/api-reference
License
MIT
Release files for langchain-goodsender 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| langchain_goodsender-0.1.1.tar.gz | 8.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_goodsender-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.0 kB
Release files / langchain_goodsender-0.1.1.tar.gz
| Download URL | langchain_goodsender-0.1.1.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8325a51b0d59f43296fc726fc7bac545fdfb7aad2afb65e00abc254dc21fb2bf
|
|
BLAKE2b-256 checksum How to use checksums |
248f7758c91237466076cac44a14f36abaea73cb4f986c99e90c1f3b2f08438c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 9, 2026.
Transparency logRelease files / langchain_goodsender-0.1.1-py3-none-any.whl
| Download URL | langchain_goodsender-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
43a4d761581c0e280158df3688916644fe1fd57da146a27266a67b2ec559c4c6
|
|
BLAKE2b-256 checksum How to use checksums |
916f1e526692231ff4b845b7de15af92eba3caabe6488a88a3bfe555b28ff462
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 9, 2026.
Transparency log