LangChain integration for GoodSender — transactional email API with consent management
Project description
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
Project details
Release history Release notifications | RSS feed
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 langchain_goodsender-0.1.1.tar.gz.
File metadata
- Download URL: langchain_goodsender-0.1.1.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8325a51b0d59f43296fc726fc7bac545fdfb7aad2afb65e00abc254dc21fb2bf
|
|
| MD5 |
90c077f69359c4bc9e86a21afbe53d33
|
|
| BLAKE2b-256 |
248f7758c91237466076cac44a14f36abaea73cb4f986c99e90c1f3b2f08438c
|
Provenance
The following attestation bundles were made for langchain_goodsender-0.1.1.tar.gz:
Publisher:
publish.yml on good-sender/langchain-goodsender
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_goodsender-0.1.1.tar.gz -
Subject digest:
8325a51b0d59f43296fc726fc7bac545fdfb7aad2afb65e00abc254dc21fb2bf - Sigstore transparency entry: 1769697599
- Sigstore integration time:
-
Permalink:
good-sender/langchain-goodsender@59440d32cca27eaf0f4ddfebdc30e0725acd29a3 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/good-sender
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@59440d32cca27eaf0f4ddfebdc30e0725acd29a3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file langchain_goodsender-0.1.1-py3-none-any.whl.
File metadata
- Download URL: langchain_goodsender-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43a4d761581c0e280158df3688916644fe1fd57da146a27266a67b2ec559c4c6
|
|
| MD5 |
1d7969d31aaf657757dab069bb8ef266
|
|
| BLAKE2b-256 |
916f1e526692231ff4b845b7de15af92eba3caabe6488a88a3bfe555b28ff462
|
Provenance
The following attestation bundles were made for langchain_goodsender-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on good-sender/langchain-goodsender
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_goodsender-0.1.1-py3-none-any.whl -
Subject digest:
43a4d761581c0e280158df3688916644fe1fd57da146a27266a67b2ec559c4c6 - Sigstore transparency entry: 1769698333
- Sigstore integration time:
-
Permalink:
good-sender/langchain-goodsender@59440d32cca27eaf0f4ddfebdc30e0725acd29a3 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/good-sender
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@59440d32cca27eaf0f4ddfebdc30e0725acd29a3 -
Trigger Event:
push
-
Statement type: