Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku and sendgrid - how to get it wired together now?

Some time back I set up a Ruby-onRails app with sendgrid and heroku. I followed a tutorial where I had to:

  • Set Credentials for Sendgrid via the webpage (herokuapp > sendgrid addon > settings > Credentials)
  • Set SENDGRID_USERNAME and SENGRID_PASSWORD as environment variables in heroku.
  • Refer to the SENDGRID_USERNAME and SENDGRID_PASSWORD in my rails application.

Fine. Or so I thought. Now I'm setting up a new app, and sendgrid has removed the "Credentials".

I have a gut feeling something is being created automatically for me, but how can I get my fingers on it and tie it together with my code? Are there some magic environment variable already available for me that I shall rather use in my code?

When I look at (the web) herokuapp > sendgrid add-on > Settings > Account details I see that there is a username and a password that is automatically generated, but how can I see what that auto-created password is so that I can get it into a heroku ENV variable?

Thanks for any help - I feel a bit lost here...

like image 247
Solvar Avatar asked Mar 10 '23 08:03

Solvar


1 Answers

You do the same thing. Every app has its own add-ons. They are not shared. If you have a new app you have to repeat what you did with your previous app:

  1. go to your resources page and add your sendgrid add-on.

  2. This creates your credentials under Settings > Config Variables. There should be SENDGRID_USERNAME and SENDGRID_PASSWORD

  3. Generate your API key on Sendgrid's site and then add it to your Config Variables (Settings > Config Variables).

Finally setup your SMTP settings in your Rails app and you are done.

How to setup Sendgrid on Heroku:

https://devcenter.heroku.com/articles/sendgrid#provisioning-the-add-on

How to setup SMTP on Rails:

https://sendgrid.com/docs/Integrate/Frameworks/rubyonrails.html

like image 78
Alexander Luna Avatar answered Mar 14 '23 15:03

Alexander Luna