Getting Started

Tribally SDK provide several custom elements of Web Components (https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) standard, which suitable for different cases.

Each element can be configured by attributes and has own behavior.

Authorization, getting and modifying data is built in this elements.

You only must add this elements into your markup and inside it will be created all what needed like posts, forms and more.

Setup

  1. Primarily you must to create a project and get API key.
    1. Go to Tribally. (https://admin.tribally.app)
    2. Create or log in to existing account.
    3. Create or use available project.
    4. Go to Settings > Administration.
    5. Request or use created API Key.
  2. Now download SDK (latest version):

sdk.zip

  1. Import downloaded SDK JavaScript file to your project.

Initialization

Tribally SDK provides two ways to initialize SDK: authorized and not authorized.

Authorized:

  1. For log in project members you need to make an endpoint in your backend. This endpoint must to request https://api.tribally.app/api/v3/auth/member/login for current authorized user and then get token for it from https://api.tribally.app/api/auth/oauth/token.
  2. Globally you have TriballySDK object which contain the init method. This method must be called with access and refresh token which you must get by previous step.
// Initialize SDK with access and refresh tokens
TriballySDK.init(access, refresh);
  1. Then add custom elements into your markup and setup it by attributes. Elements authomaticaly uses token when it available for initialization.
...
<tribally-feed></tribally-feed>
...

Unauthorized:

If you want to let your users to watch feed without authorization, in step 2 you should do this: