How do I implement Amity.co on WeWeb + Xano stack?

Hi everyone!

Has anyone implemented Amity.co with WeWeb+Xano stack? Can you point me in the right direction where to get started?

To give you an idea of where I am so far:

Amity needs an TS SDK installation to get started where would I do that? Should I create a WeWeb custom component to do that?


import { Client, API_REGIONS } from '@amityco/ts-sdk';

// Only required to do once in the lifetime of the application
const client = Client.createClient('api-key', API_REGIONS.SG); // SG is the default

/*
 *  Check the session handler section in session state core concept for full details
 */
const sessionHandler: Amity.SessionHandler = {
  sessionWillRenewAccessToken(renewal: Amity.AccessTokenRenewal) {
    // for details on other renewal methods check session handler
    renewal.renew();
  },
};

(async () => {
  const isConnected = await Client.login(
    {
      userId: 'my-user-id',
      displayName: 'my-display-name', // optional
      authToken: '', // only required if using secure mode
    },
    sessionHandler,
  );
})();

Once it’s installed to create a text post you would need to use the code below.

Is this the WeWeb custom element component as well?

The input from the front end will be passed into ‘text’ and ‘targetId’ would come from Xano?

How do I push the created post back into Xano? Add a button that sends all the info attached to ‘post’ to Xano?

import { PostRepository, PostContentType } from '@amityco/ts-sdk';

async function createPost() {
  const newPost = {
    tags: ['a', 'b'], // optional, max no.of tags = 5, max length per tag = 24 chars
    data: {
      text: 'hello!',
    },
    targetType: 'user',
    targetId: 'userId1',
  };

  const { data: post } = await PostRepository.createPost(newPost);

  return post;
}

Am I on the right track?
Full Amity documentation for reference: https://docs.amity.co/

Thank you!