Contextual apps

Contextual apps differs from context-independant apps like the messenger app in that it needs to be created and the user needs to be a member of the app before it can be loaded using our frontend libraries. You can use the REST API to init the app on your server side before loading the contextual app from your frontend.

Example: Execute a single request that creates the app (if it does not already exist) with the given identifier (that is the required id parameter you use when you define the app). Then the user with the given iss and sub (see JWT) will be added as a member in that app (if the user is not already a member).

$ curl -H 'Authorization: Bearer {token}' https://{weavy-server}/api/apps/init -d '{"identifier":"my-chat", "iss":"identity-provider-issuer", "sub":"user-32", "type":"chat"}'

After the request is sent you can load and display the app using your frontend. For example the Chat component:

<WeavyProvider client={weavyClient}>    
    <Chat id="my-chat" />            
</WeavyProvider>

Fig 1. Contextual Chat component.

Weavy Docs