INFO

Python 3.7 or later is required.

  1. Make sure you have the latest version of Python installed.
  2. Sign up for Courier to get access to your API key.
  3. Add the channel(s) you wish to send your message to.
  4. Run pip install trycourier or poetry add trycourier to install the Courier Python SDK.
  5. Use the Courier class to access all of our endpoints.
  6. Add the following code and replace <YOUR_TOKEN> with your Courier API key:
  import os
  import courier

  from courier.client import Courier

  client = Courier(
    authorization_token="YOUR_TOKEN" # Defaults to COURIER_AUTH_TOKEN
  )

  response = client.send(
    message=courier.ContentMessage(
      to=courier.UserRecipient(
        email="marty_mcfly@email.com",
        data={
          name: "Marty",
        }
      ),
      content=courier.ElementalContentSugar(
        title="Back to the Future",
        body="Oh my {{name}}, we need 1.21 Gigawatts!",
      ),
      routing=courier.Routing(
        method=courier.RoutingMethod.ALL,
        channels=["email"]
      )
    )
  )

  print(response)

Explore how to customize your notification with more properties

  1. Run your code. Upon running this API call, only a requestId will be returned.
    { "requestId": "87e7c05b-4f46-fda24e356e23" }
    
  2. Monitor the status of your notification (once sent) in the logs: https://app.courier.com/logs

FAQs

Questions?

Join our developer community on Discord and ask questions in the #ask-support channel.