Skip to content

Latest commit

 

History

History
66 lines (43 loc) · 2.16 KB

README.rdoc

File metadata and controls

66 lines (43 loc) · 2.16 KB

SalesKing App Examples

SalesKing can be connected and enhanced using the API and Apps. Our Apps are using oAuth2 for authentication and authorization, like you may know it from facebook. When registering your app in SalesKing you get credentials(app id + secret) needed to identify your app and establish a trusted connection.

Examples

Before you start coding:

  • register your app in your SalesKing account ../developers/apps

  • grab a shiny new pair of app key & secret

Depending on the example our are using, Provide the right url’s(app and canvas ) in the registration form and then edit the apps settings(inline) or the settings.yml file.

PHP plain

github.com/salesking/sk_app_examples/blob/master/php/plain_oauth.php

Completely stripped down example, visualizing:

  • user authentication

  • app authorization

  • app authentication

One page does it all, no caching or saving of access token or user information, so definitely NOT something you want to use in production.

Ruby

The ruby examples impose some dependencies:

  • Sinatra: as webserver lifting the scripts into your browser

  • Curb(Curl): making the web requests, especially HTTPS without hassle

Most apps use bundler to prevent the gem-hassle and can be racked-up. Sinatra, by default, starts on port 4567, so you should use the following url when registering your app: http ://localhost:4567

Plain login

This is the same as the plain php example, a single view handling the triple-oAuth2 jump. github.com/salesking/sk_app_examples/blob/master/ruby/sinatra_plain/example.rb

Advanced login

The app saves login information(access_token) encrypted in a cookie. It also demonstrates how to deal with dynamic SalesKing URL’s(Subdomain for each account).

github.com/salesking/sk_app_examples/tree/master/ruby/sinatra_adv

Push Notifications / PubSub

An app showing how to register for push notifications(WebHooks/PubSub) and how to deal with the callback results

github.com/salesking/sk_app_examples/tree/master/ruby/sinatra_pubsub

Payment chart

Show payment or invoice stats in a zoomable chart.

github.com/salesking/sk_app_examples/tree/master/ruby/sinatra_stats