Skip to content

Latest commit

 

History

History
56 lines (43 loc) · 1.51 KB

File metadata and controls

56 lines (43 loc) · 1.51 KB

Yournotify Python

Python SDK for the current Yournotify API.

Install

pip install yournotify-python

Quickstart

from yournotify import Yournotify, YournotifyApiError

client = Yournotify("YOURNOTIFY_API_KEY")

try:
	client.validate_auth()
	client.send_email(
		"Welcome campaign",
		"Welcome",
		"<p>Hello</p>",
		"Hello",
		"draft",
		"noreply@smtp.yournotify.net",
		[{"email": "person@example.com", "name": "Person"}],
	)
except YournotifyApiError as exc:
	print(exc.status_code, exc.body)

Campaigns

client.create_campaign({"name": "WhatsApp", "channel": "whatsapp", "template_id": "template_123"})
client.send_sms("SMS", "YTAuth", "Hello", "draft", [{"telephone": "+2348100000000"}])
client.send_whatsapp({"name": "WhatsApp", "template_id": "template_123"})
client.send_push({"name": "Push", "title": "Hello", "body": "Welcome"})
client.send_in_app({"name": "In-app", "title": "Hello", "body": "Welcome"})
client.test_campaign({"channel": "email", "email": "person@example.com"})

Contacts, Lists, Rewards, Automation

client.add_contact("person@example.com", "+2348100000000", [123], "Person", {"source": "python"})
client.get_contacts({"page": 1})
client.add_list("Newsletter", "public", "single")

client.create_reward({"name": "Referral reward"})
client.send_reward({"reward_id": 123, "email": "person@example.com"})

client.identify({"external_id": "user_123", "email": "person@example.com"})
client.track({"event": "checkout.completed", "external_id": "user_123"})