Send Immediate Membership Confirmation After Account Creation

Hi everyone,

I’m currently working on a webhook listener that handles events from Amity Social Cloud. Whenever a new user is created (user.didCreate event), the user is automatically added to a community. Here’s the code I’m using:

import axios from 'axios';
import { Request, Response } from 'express';

export const handleAmityEvents = async (req: Request, res: Response) => {
  const event = req.body;
  if (event.event === "user.didCreate") {
    handleAddUserToCommunity(event.data.users[0].userId);
  }
  return res.json(event);
};

const handleAddUserToCommunity = async (userId: string) => {
  const communityId = await getOneApiKeyAdmin({ keyName: "communityId" });

  axios.post(`https://api.sg.amity.co/api/v3/communities/${communityId}/users`, {
    userIds: [userId],
  }, {
    headers: {
      'Authorization': `Bearer ${process.env.AMITY_ADMIN_KEY}`
    }
  }).then((res) => {
    // Handle successful response
  }).catch((err) => {
    // Handle error
  });
};

The new users are being added to the community without problems. However, I want to ask for user consent before adding them to the community. Specifically, I want to show them a pop-up to confirm if they want to join the community.
How can I do that?

Hello @cadybo , Thank you for your question. Currently, we do not have a built-in feature to ask for user consent before adding them to a community. You will need to implement this on your side. We will also forward this request to our product team for future consideration and improvements.

Hi @SocialPlus_Support ,

Thanks for your response. Do you have any suggestions or best practices on how I can implement this user consent feature on my end?

Hello @cadybo, unfortunately, we don’t have a detailed guide available for this scenario. However, since you mentioned a pop-up, it should be handled on both the frontend and backend. You might need to do some additional exploring to get the full picture.

Please let us know if you have any other questions or if there’s anything else we can assist you with.