https://discord.gg/botpress logo
Hello everyone, in the company where I work we hav...
# 💻developers
g
Hello everyone, in the company where I work we have developed a support bot. However, there is an important detail: the bot must respond only with information related to the country of the authenticated user of our system. To achieve this, it is essential that every time the user sends a message the bot already has the user's information from our system. However, it encountered an obstacle: not being able to create new users directly from the webchat client; I only have the option to update existing users. For this reason, I am sending the necessary information through the data as follows:
Copy code
const connectClient = async () => {
      try {
        //cuando conecta, genera un usuario
        await client.connect();
        setIsConnected(true);
        console.log("Conectado al bot");

        //acá actualizo ese usuario con la información de soa
        await client.updateUser({
          name: userSoa?.first_name,
          data: { userSoa },
        });

        //acá obtiene la información del usuario del chat actual
        const userChat = await client.getUser();
        console.log(userChat);
      } catch (error) {
        console.error("Error al conectar:", error);
      }
    };
Im using Webchat Client V2, I appreciate any suggestions or help you can offer me to resolve this issue. Thank you!