createBot method

Future<CreateBotResponse> createBot({
  1. required String challenge,
  2. required String groupId,
  3. required String networkId,
  4. required String username,
  5. String? displayName,
})

Creates a new bot in a specified Wickr network. Bots are automated accounts that can send and receive messages, enabling integration with external systems and automation of tasks.

May throw BadRequestError. May throw ForbiddenError. May throw InternalServerError. May throw RateLimitError. May throw ResourceNotFoundError. May throw UnauthorizedError. May throw ValidationError.

Parameter challenge : The password for the bot account.

Parameter groupId : The ID of the security group to which the bot will be assigned.

Parameter networkId : The ID of the Wickr network where the bot will be created.

Parameter username : The username for the bot. This must be unique within the network and follow the network's naming conventions.

Parameter displayName : The display name for the bot that will be visible to users in the network.

Implementation

Future<CreateBotResponse> createBot({
  required String challenge,
  required String groupId,
  required String networkId,
  required String username,
  String? displayName,
}) async {
  final $payload = <String, dynamic>{
    'challenge': challenge,
    'groupId': groupId,
    'username': username,
    if (displayName != null) 'displayName': displayName,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/networks/${Uri.encodeComponent(networkId)}/bots',
    exceptionFnMap: _exceptionFns,
  );
  return CreateBotResponse.fromJson(response);
}