from siren import SirenClient
# Uses SIREN_API_KEY and SIREN_ENV environment variables
client = SirenClient()
# Send a direct message without template
message_id = client.message.send(
recipient_value="[email protected]",
channel="EMAIL",
body="Your account has been successfully verified. You can now access all features."
)
# Send a message using a template
message_id = client.message.send(
recipient_value="U01UBCD06BB",
channel="SLACK",
template_name="welcome_template",
template_variables={"user_name": "John"},
)
# Send a message with specific provider
from siren.models.messaging import ProviderCode
message_id = client.message.send(
recipient_value="[email protected]",
channel="EMAIL",
body="Your account has been successfully verified.",
provider_name="email-provider",
provider_code=ProviderCode.EMAIL_SENDGRID,
)
# Send a message using awesome template
message_id = client.message.send_awesome_template(
recipient_value="U01UBCD06BB",
channel="SLACK",
template_identifier="awesome-templates/customer-support/escalation_required/official/casual.yaml",
template_variables={
"ticket_id": "123456",
"customer_name": "John",
"issue_summary": "Payment processing issue",
"ticket_url": "https://support.company.com/ticket/123456",
"sender_name": "Support Team"
},
provider_name="slack-provider",
provider_code=ProviderCode.SLACK,
)
# Alternative initialization
client = SirenClient(api_key="YOUR_SIREN_API_KEY") # default env is "prod"
# Or:
client = SirenClient(api_key="YOUR_SIREN_API_KEY", env="dev")