Skip to content

feat: support resend templates#12

Open
IdrisHanafi wants to merge 1 commit into
elixir-saas:mainfrom
IdrisHanafi:feat/support-resend-templates
Open

feat: support resend templates#12
IdrisHanafi wants to merge 1 commit into
elixir-saas:mainfrom
IdrisHanafi:feat/support-resend-templates

Conversation

@IdrisHanafi

Copy link
Copy Markdown

What's new?

Adding support for Resend templates, i.e.:

curl -X POST 'https://api.resend.com/emails' \
  -H 'Authorization: Bearer re_xxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d $'{
    "from": "Acme <onboarding@resend.dev>",
    "to": "delivered@resend.dev",
    "template": {
      "id": "order-confirmation",
      "variables": {
        "PRODUCT": "Vintage Macintosh",
        "PRICE": 499
      }
    }
}'

Testing

mix test

And some manual testing by:

$ iex -S mix
> client = Resend.client(api_key: "re_your_api_key_here")
> Resend.Emails.send(client, %{
  from: "Your Name <[email protected]>",
  subject: "test subject",
  to: "[email protected]",
  template: %{
    id: "your-template-id",
    variables: %{
      YOUR_VARIABLE_NAME: "Your Variable Value"
    }
  }
})

@itzmidinesh

Copy link
Copy Markdown

Thanks for working on the template support! We're currently evaluating Resend as an alternative and templates are critical for our use case.

Are there plans to merge this into the library?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants