Web

Reference for integrating with the Okra Widget JavaScript SDK

Installation

Include the Okra Widget initialize script on each page of your site. It should always be loaded directly from https://cdn.okra.ng, rather than included in a bundle or hosted yourself.

How it works

#CDN
<script src="https://cdn.okra.ng/v2/bundle.js"></script>

#NPM
npm install okra-js 

#Yarn
yarn add okra-js
import Okra from 'okra-js'

Okra.buildWithShortUrl({
    short_url: '', //Your short url from the link builder
    onSuccess: function(data){
        console.log('options success', data)
    },
    onClose: function(){
        console.log('options close')
    }
})
import Okra from 'okra-js'

Okra.buildWithOptions({
    name: 'Peter the Builder',
    env: 'production-sandbox',
    app_id: ''// app_id from your app builder
    key: '', // Your key from the Okra dashboard
    token: '', // Your token from the okra dashboard
    onSuccess: function(data){
        console.log('options success', data)
    },
    onClose: function(){
        console.log('options close')
    }
})

📘

Need more options?

Checkout a list of all the available Widget Properties to add to your widget options below.

Not a developer

Get started without writing a single line of code, Try our App Builder! Click here to get started


What's Next

View all our Libraries & SDKs or get started with an API Overview

Did this page help you?