Skip to main content

Extensions with Light Grill

Light Grill an experimental version of Grill Chat, introduces support for Custom Extensions that broadens the scope of in-chat elements to build great experience for your users.

What are extensions?

An extension is a schema definition for a new set of chat elements with proper components and a very specific use case for sharing information.Extension data is stored along with the related chat message content in IPFS.

Example

The NFT Extension allows people to share NFTs as a chat element in the Grill app from different chains like Ethereum, Solana, etc.

How do extensions work?

Every extension have three things:

  • An input form for the user to share data about the chat element (for example, the contract address & token id of an NFT)
  • JSON Schema to set the structure of the data for storage before it is sent to IPFS
  • Parser with React component that shows the chat element in the Grill App UI and gives users a functionality to interact with.

Structuring an extension in the chat

A typical chat message on Grill has the following schema when it is sent to IPFS for storage. The data of each extension can be stored in the extensions field of the related chat message.

{
"body": "", // Chat message here.
"extensions": [ // Array of chat extensions.
{...}, // Extension for NFT.
{...}, // Extension for Image.
{...} // or any other extension.
]
}

Learn how to build an extension from scratch in our Zero to Hero Guide.

How to define a schema structure?

The schema for an extension explains how its content should be stored on IPFS and it should follow the next format:

{
"id": "string",
"properties": {
// Your schema structure here.
}
}