Integrating Force.com and Heroku Using REST and Bulk APIs Mark Puddick, Moroku, CTO @MarkPudd
Jan 26, 2015
Integrating Force.com and HerokuIntegrating Force.com and HerokuUsing REST and Bulk APIs
Mark Puddick, Moroku, CTO
@MarkPudd
Mark PuddickMark Puddick
CTO, MorokuCTO, Moroku
Agenda
- Moroku Game System
- Authorization
- REST
- Bulk
- Polls Demonstration
Game System - Objective
• We Gamify bank customers banking
• Allow Player to gain points for banking activities such as goal
setting
• Points, badges and leaderboard mechanics are used
• We use Heroku to run our Game Server
• Sync with Force.com
• Sync quizzes, analytics and players
Game System - High Level Architecture
MobileApp
Bank Customers
Bank Admin
Moroku Game ServerGame FunctionalityAnalytics Summary
Generation
Moroku Game ConsoleConfiguration
Analytics ViewsRESTBulk API
Why?
• High request volume with Heroku
• Heroku gives us some great options to scale
• Administration with Force.com
• User management
• Integration points
• Familiar look and feel
Authentication
• Options
• Basic username/password
• Access Token/Refresh Flow
• Encrypted Token storage
• Configuration
• Sign on URL
REST API
- Obtain Information about Salesforce or Force.com objects
- Perform SOQL queries
- Update or delete records
Using REST API – SOQL to get Configuration
• Quiz configuration is done within Force.com
• Daily batch job syncs the quizzes with Heroku
• Heroku scheduler run the batches
• REST API used the get the quizzes
• Potential to run on demand
Using REST API – SOQL to get Configuration
Daily Batch
Using REST API -SOQL to update Analytics
• Analytics are generated around what players have been doing
• Generated from Postgres or Treasure Data
• Scheduled on Heroku Batch twice per day
• Reports, graphs and dashboard created for the bank
Using REST API -SOQL to update Analytics
Twice daily batch
Using BulkAPI
• Create Job – specifies the object and action
• Create Batch of content – player information
• Create subsequent batch if needed
• Close job
• Check status and results
Bulk API – Update Customers Points
• Users points balance and goals uploaded
• Runs as a daily batch
• Leaderboards generated in Force.com
• Goal distribution shown in dashboard
Bulk API – Update Customers Points
Daily Batch
Example Application – Setup Poll and Sync
Sync
Code
Github - [email protected]:markmoro/poll_demo.git
All about
Moroku makes banking fun because:
•Financial Mastery is both very important and very difficult for lots of people.
•Fun is the most ancient and proven mechanism for learning skills and
delivering outcomes: “People rarely succeed unless they have fun in what
they are doing”: Dale Carnegie, 7 Habits ……
.
Established January 2012, Sydney Australia
May 2012, Game System Beta Released
August 2012: Red Herring Asia 100
September 2013, First bank goes live
Mark PuddickMark Puddick
CTO, Moroku