emailing-and-texting-script icon indicating copy to clipboard operation
emailing-and-texting-script copied to clipboard

Java code to send emails and texts at intervals

emailing-and-texting-script

Java code to send emails and texts at intervals. Made to support the #EndSarsNow Campaign.

Getting Started

Prerequisites

  • Git
  • Intelli J (or similar)
  • Heroku Account
  • Heroku CLI installed
  • Twilio Account (for SMS)
  • Gmail & Gmail App Password (Read about how to create a gmail app password here)

Relevant Properties

Fill in properties file

  1. spring.mail.username - Gmail address
  2. spring.mail.password - Gmail App Password
  3. account.sid - Account SID from Twilio Account
  4. auth.token - Authentication token from Twilio Account
  5. from.phone.number - Phone number from Twilio Account
  6. dispatch.cron - Define the cron to send smses and emails to each official here. It is currently set to send the smses and emails by 9am every day.
  7. activate.script - Set to true/false to activate/deactivate the script
  8. send.sms - Set to false/true to turn off/on sending smses
  9. send.email - Set to false/true to turn off/on sending emails

See details on how to generate a good cron for Spring here

Deploying

  1. Add Procfile (This is already done, so skip)
  2. Login to Heroku (on your browser)
  3. Create a new app
  4. Go into the directory of this application via your terminal:
  • cd ~/emailing-and-texting-script
  • heroku login
  • heroku git:remote -a {name.of.the.app.you.created}
  • git push heroku master or git push heroku {your.local.branch}:master if you're not pushing from your local master branch

Ways to Run Locally

  • Use relevant cron and run the application

  • Add to EmailingAndTextingScriptApplication and run the application

    @Autowired
    ScheduledMessagingScript messagingScript;
    
    @Bean
    
        public CommandLineRunner runScript() {
            return args -> {
                messagingScript.dispatchCommunication();
            };
        }
    

Urgent

  • Fork repo
  • Fill in government official details here
  • Create PR

Contributions

Contributions are very welcome. See the issues

Contributors

Relevant Third Party Tools