[SOLVED] Question about API NFT-Gating

The Moralis nft-gating model takes user information and creates an “NFTList” and generates a JSON from it. My question is: Is it possible to send the NFTList or JSON information to google sheets, for example? How can I do this?

export async function getServerSideProps(context) {

    const session = await getSession(context);

    if (!session) {
        return {
            redirect: {
                destination: '/signin',
                permanent: false,
            },
        };
    }

    await Moralis.start({ apiKey: process.env.MORALIS_API_KEY });

    const nftList = await Moralis.EvmApi.account.getNFTsForContract({
        address: session.user.address,
        tokenAddress: 'xxx',
        chain: 80001 // defualt 1 (ETH)
    });

    return {
        props: {
            message:
                nftList.raw.total > 0 ? 'Nice! You have our NFT' : "Sorry, you don't have our NFT",
            nftList: nftList.raw.result
        },
    };
    
}

On return it generates a JSON:

<pre>{JSON.stringify(nftList, null, 2)}</pre>

Is it possible to use either of these two to send to a google sheets?

The below thread can give info on this.

You need to create a webhook URL for your google sheet and post data from frontend to it.

I tried to follow the example but couldn’t make it, I don’t know if it is because I am using Nextjs.

Do you think it is best to try to send the JSON file to the google sheets or try sending the information directly from the “NftList”?

I also found something about a code that receives on google sheets information from a JSON formatted, but for that I would need an API URL, does Moralis gives that API URL for that situation? So that I could send the data from it to the google sheets file.

Thank you for your help, and I am sorry for my lack of knowledge but I am a beginner.

I believe you are referring to the webhook URL, In that case, you need to create it yourself.

You can search on google, on how to get a webhook URL to connect to google sheets.