{"id":27947875,"url":"https://github.com/luckyframework/carbon_sendgrid_adapter","last_synced_at":"2026-02-23T18:33:49.963Z","repository":{"id":39643812,"uuid":"350868304","full_name":"luckyframework/carbon_sendgrid_adapter","owner":"luckyframework","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-15T21:38:43.000Z","size":47,"stargazers_count":1,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-16T00:49:09.986Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Crystal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luckyframework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-03-23T21:56:24.000Z","updated_at":"2026-01-15T21:38:47.000Z","dependencies_parsed_at":"2025-05-07T14:44:52.643Z","dependency_job_id":"f5b13a76-c662-4d8b-8267-9aeb593f2f56","html_url":"https://github.com/luckyframework/carbon_sendgrid_adapter","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/luckyframework/carbon_sendgrid_adapter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckyframework%2Fcarbon_sendgrid_adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckyframework%2Fcarbon_sendgrid_adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckyframework%2Fcarbon_sendgrid_adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckyframework%2Fcarbon_sendgrid_adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luckyframework","download_url":"https://codeload.github.com/luckyframework/carbon_sendgrid_adapter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckyframework%2Fcarbon_sendgrid_adapter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29750619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T07:44:07.782Z","status":"ssl_error","status_checked_at":"2026-02-23T07:44:07.432Z","response_time":90,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-07T14:38:19.308Z","updated_at":"2026-02-23T18:33:49.947Z","avatar_url":"https://github.com/luckyframework.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Carbon SendGrid Adapter\n\nIntegration for Lucky's [Carbon](https://github.com/luckyframework/carbon) email library and [SendGrid](https://sendgrid.com).\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n   ```yaml\n   dependencies:\n     carbon_sendgrid_adapter:\n       github: luckyframework/carbon_sendgrid_adapter\n   ```\n\n2. Run `shards install`\n\n## Usage\n\nCreate an environment variable called `SEND_GRID_KEY` with your SendGrid api key.\n\nUpdate your `config/email.cr` file to use SendGrid\n\n```crystal\nrequire \"carbon_sendgrid_adapter\"\n\nBaseEmail.configure do |settings|\n if LuckyEnv.production?\n   send_grid_key = send_grid_key_from_env\n   settings.adapter = Carbon::SendGridAdapter.new(api_key: send_grid_key)\n else\n  settings.adapter = Carbon::DevAdapter.new\n end\nend\n\nprivate def send_grid_key_from_env\n  ENV[\"SEND_GRID_KEY\"]? || raise_missing_key_message\nend\n\nprivate def raise_missing_key_message\n  puts \"Missing SEND_GRID_KEY. Set the SEND_GRID_KEY env variable to 'unused' if not sending emails, or set the SEND_GRID_KEY ENV var.\".colorize.red\n  exit(1)\nend\n```\n\n### Sending Dynamic Template emails\n\nSendGrid allows you to use [Dynamic Transactional Templates](https://docs.sendgrid.com/ui/sending-email/how-to-send-an-email-with-dynamic-transactional-templates) when\nsending your emails. These templates are designed and created inside of the\nSendGrid website.\n\nDefine a `template_id`, and `dynamic_template_data` method in your\nemail class to use the dynamic template.\n\n1. Login to SendGrid\n2. Select Email API \u003e Dynamic Templates\n3. Create a new template\n4. Copy the \"Template-ID\" value for that template.\n5. Update your email class\n\n```crystal\n# Using built-in templates\nclass WelcomeEmail \u003c BaseEmail\n  def initialize(@user : User)\n  end\n\n  to @user\n  subject \"Welcome - Confirm Your Email\"\n  templates html, text\nend\n```\n\n```crystal\n# Using dynamic templates\nclass WelcomeEmail \u003c BaseEmail\n  def initialize(@user : User)\n  end\n\n  # This must be the String value of your ID\n  def template_id\n    \"d-12345abcd6543dcbaffeedd1122aabb\"\n  end\n\n  # This is optional. Define a Hash with your\n  # custom handlebars variables\n  def dynamic_template_data\n    {\n      \"username\" =\u003e @user.username,\n      \"confirmEmailUrl\" =\u003e \"https://myapp.com/confirm?token=...\"\n    }\n  end\n\n  to @user\n  subject \"Welcome - Confirm Your Email\"\nend\n```\n\nNOTE: SendGrid requires you to either define `template_id` or use the `templates` macro\nto generate an email body content.\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/luckyframework/carbon_sendgrid_adapter/fork\u003e)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Matthew McGarvey](https://github.com/matthewmcgarvey) - maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluckyframework%2Fcarbon_sendgrid_adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluckyframework%2Fcarbon_sendgrid_adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluckyframework%2Fcarbon_sendgrid_adapter/lists"}