Skip to content
This repository has been archived by the owner on Mar 7, 2021. It is now read-only.

Ballerina Day : Colombo - Sample reminder app, which sends SMS accordingly to the tasks set by Google Tasks

Notifications You must be signed in to change notification settings

ldclakmal/ballerina-reminder-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Ballerina Reminder App

This app will fetch the Google Tasks set by you and schedule the SMS notifications reminding that there is a task scheduled. This project is based on ballerina [GTasks connector[(https://central.ballerina.io/chanakal/gtasks) and Twilio connector.

How to Configure

  1. First, you need to have a Google account and a Twilio account obtain credentials.

How to obtain Google OAuth2.0 Credentials

  1. Visit Google API Console, click Create Project, and follow the wizard to create a new project.
  2. Go to Dashboard, click on ENABLE APIS AND SERVICES and select the Google Task API and click ENABLE.
  3. Go to Credentials → OAuth consent screen, enter a product name to be shown to users, and click Save.
  4. On the Credentials tab, click Create credentials and select OAuth Client ID.
  5. Select an application type, enter a name for the application, and specify a redirect URI.
  1. Click Create. Your Client ID and Client Secret will appear as a popup.
  2. In a separate browser window or tab, visit OAuth 2.0 playground.
  3. Click the ⚙️ (settings icon) at the top right corner and you can obtain Token endpoint.
  4. Tick Use your own OAuth credentials in pop-down of ⚙️ and paste the obtained Client ID and Client Secret there.
  5. At the left side of the window, under Step 1 - Select & authorize APIs, select the required Google Task API scopes, and then click Authorize APIs.
  6. When you receive your Authorization Code, click Exchange Authorization Code for tokens to obtain the Refresh Token and Access token.

How to obtain Twilio Credentials

  1. Login to the Twilio account created.
  2. Go to Products tab --> Programmable SMS and select Continue.
  3. Give a name for the project and click Continue*. Skip the Custom Project step.
  4. In the Console Dashboard, you can see the Project Info tab with ACCOUNT SID. Click on the tab and obtain the ACCOUNT SID and AUTH TOKEN.
  • Now you have obtained all the credentials you want.

  1. Go to Programmable SMS at Twilio account and get a Twilio phone number in order to send SMS.
  2. Create a ballerina.conf file at the same level of app directory and update the credentials and the phone numbers as follows. Make sure to add the the phone numbers with country code, without brackets and dashes.
ACCESS_TOKEN=""
CLIENT_ID=""
CLIENT_SECRET=""
REFRESH_TOKEN=""

ACCOUNT_SID=""
AUTH_TOKEN=""
FROM_MOBILE=""
TO_MOBILE=""
  • Now you are done with configurations.

How to Start

  1. Create a task at the Google Tasks in following format.
Notify Me /1
  1. Run the app executing following command from the project level.
$ ballerina run app --config ballerina.conf

You can see the output something similar to following and the SMS will be sent received in 1 minute.

2018-08-11 09:59:18,133 INFO  [app:0.0.0] - Picked: Notify Me /1
2018-08-11 09:59:18,139 INFO  [app:0.0.0] - Scheduling appointment
2018-08-11 09:59:19,048 INFO  [app:0.0.0] - Scheduled appointment and mark the task as scheduled
2018-08-11 10:00:01,021 INFO  [app:0.0.0] - Triggered the task
2018-08-11 10:00:01,024 INFO  [app:0.0.0] - SMS Sending FROM: +1234567890 TO: +94771234567
2018-08-11 10:00:02,607 INFO  [app:0.0.0] - SMS ID: SMf836b45741gy46fd8b68ca62c4c840a1 STATUS: queued
2018-08-11 10:00:02,608 INFO  [app:0.0.0] - Cancelling the appointment

You are done !

About

Ballerina Day : Colombo - Sample reminder app, which sends SMS accordingly to the tasks set by Google Tasks

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published