Using AI chat bots with Weavy

Weavy has built-in support for AI chat bots. This allows users to engage with an AI in real-time, making Weavy not just a platform for human-to-human interaction, but also a comprehensive tool for information retrieval, task automation, and learning.

Create bot

Before communicating with an AI through Weavy you need to create a dedicated bot user. This step ensures that the AI bot operates as a recognized entity, distinct from human users. You create a bot with a call to the Users API as seen below:

curl https://{WEAVY-SERVER}/api/users
-H "Authorization: Bearer {API-KEY}"
--json "{ 'uid': 'clark', 'name': 'Clark', 'is_bot': true, 'metadata': {'family': 'openai', 'model': 'gpt-4o'} }"
  • uid: A unique identifier for the bot user.
  • name: Display name of the bot. This is the name your users will use when @mentioning the bot.
  • is_bot: Set to true to indicate that this is a bot and not a human user.
  • metadata.family: Specifies the family/platform for the bot. Must be one of openai, claude, gemini, or kapa.
  • metadata.model: Model the bot should use (when applicable). When not specified Weavy tries to select a sensible default value.
  • metadata.api_key: The API key to use when communicating with the underlying AI platform.

For details on available models, and how to obtain API keys for authentication, we recommend visiting the developer docs for respective supported platform:

Interact with bot

To effectively utilize a bot in Weavy, the bot must first be notified that its presence is required. To engage the bot within a comment, post or message, users must mention the bot by typing @ followed by the bot's name.

The need to mention the bot for activation allows for a controlled use of the bot's capabilities, making it an efficient participant in discussions where its input is relevant.

One exception exists, in a private chat with a bot, a user can engage directly with the bot without mentioning it. This is akin to chatting with another person, where messages are exchanged seamlessly between the user and the bot. The direct nature of this interaction allows for a more personalized experience, enabling the bot to provide tailored responses, support, and assistance based on the user's immediate needs and queries.

Use single bot mode in Messenger

The messenger building block can be used in a mode tailored for one-to-one chats with a bot. This limits the messenger to conversations with a specified bot and is a great way to keep track of AI conversations.

To use messenger in bot mode, all you need to do is create a bot user as described above, and then specify it's uid when initializing the <wy-messenger> component.

<wy-messenger bot="clark"></wy-messenger>

Troubleshooting

If your interactions with the bot is not working it usually comes down to one of these things:

  1. To use the Weavy chat bot integration, you need the Pro version of the building block you're adding it to.
  2. The bot user was configured with an unsupported metadata.family or you forgot to set the is_bot property.
  3. The bot user was configured without a valid metadata.api_key for the AI platform.
  4. The bot does not have permission to respond. This can happen if the bot user does not have write access in the app where you interacted. See apps and permissions.