sendgrid integration and process foreground changes