Examples

Widget WebUI

To use the widget inside a WebUI component on a mobile device, there are a few considerations that this sample takes into account.

  1. It launches the widget immediately if you want to user to select the source from our list
  2. It prevents the popup window from opening so that the OAuth flow will reuse the same WebUI
  3. It receives the contacts in Javascript using our afterSubmitContacts callback.

<script src="https://api.cloudsponge.com/widget/localhost-only.js"></script>
<script>
cloudsponge.init({
  // automatically show the widget once it is ready:
  autoLaunch: true,
  // restrict the widget to a single window, no popups allowed here
  inlineOauth: true,
  // receive the contacts via Javascript
  afterSubmitContacts: function(contacts, source, owner) {
    // it's time to sent the contacts back to the owner of this window.
    alert('Got '+contacts.length+' contacts from the user');
  },
  // what if the import failed?
  afterImport: function(source, success, code) {
    if (!success) {
      // the widget will display an error to the user
      // your app may want to take additional action at this time
    }
  },
  afterClosing: function() {
    // the widget has just closed so your app may want to clean up the WebUI now
  }
});
</script>

Try CloudSponge for free in your
testing environment

Get a Free Sandbox Account

Have a questions or prefer a guided tour?
Schedule a consultation with our Founder.