1. Home
  2. Docs
  3. Embedding Rali
  4. Generating Embed Links
  5. Generating User Data for Embed

Generating User Data for Embed

The format below can be used to generate your own user details for embed links.  The user data is in the format of the encoded JSON user object schema specified below:

{
  "title": "user",
  "type": "object",
  "properties": {
    "displayName": {
      "type": "string",
      "description": "user name shown in UI"
    },
    "id": {
      "type": "string",
      "description": "unique identifier used by external system"
    },
    "username": {
      "type": "string",
      "description": "user email or username"
    },
    "url": {
      "type": "string",
      "description": "url to user avatar image" 
    }
  },
  "required": [
    "id"
  ]
}

Encoding the user object via JavaScript can be done client-side or server-side. (For Node, you may need the `btoa` npm package.)  Here is an example of a user and how it could be encoded.

const user = {
  id: 'xxx-yyy-zzz',
  displayName: 'Mr. Adams',
  username: ‘adams@gmail.com’,
  url: 'https://cdn.filestackcontent.com/SdYcGIgBQoK5Ooijbwb5',
}
 

const encodedUser = btoa(encodeURIComponent(JSON.stringify(user)))

References:

http://json-schema.org/

https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding

Was this article helpful to you? Yes No

How can we help?