emailing-and-texting-script
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
-
spring.mail.username
- Gmail address -
spring.mail.password
- Gmail App Password -
account.sid
- Account SID from Twilio Account -
auth.token
- Authentication token from Twilio Account -
from.phone.number
- Phone number from Twilio Account -
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. -
activate.script
- Set to true/false to activate/deactivate the script -
send.sms
- Set to false/true to turn off/on sending smses -
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
- Add Procfile (This is already done, so skip)
- Login to Heroku (on your browser)
- Create a new app
- 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
orgit 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