sendMessage method

Future<DynamiteResponse<BotSendMessageResponseApplicationJson, void>> sendMessage({
  1. required String message,
  2. required String token,
  3. String? referenceId,
  4. int? replyTo,
  5. int? silent,
  6. BotSendMessageApiVersion? apiVersion,
  7. bool? oCSAPIRequest,
})

Sends a new chat message to the given room.

The author and timestamp are automatically set to the current user/guest and time.

Returns a Future containing a DynamiteResponse with the status code, deserialized body and headers. Throws a DynamiteApiException if the API call does not return an expected status code.

Parameters:

  • message The message to send.
  • referenceId For the message to be able to later identify it again. Defaults to ''.
  • replyTo Parent id which this message is a reply to. Defaults to 0.
  • silent If sent silent the chat message will not create any notifications. Defaults to 0.
  • apiVersion Defaults to v1.
  • token Conversation token.
  • oCSAPIRequest Required to be true for the API request to pass. Defaults to true.

Status codes:

  • 201: Message sent successfully
  • 400: Sending message is not possible
  • 401: Sending message is not allowed
  • 413: Message too long

See:

Implementation

Future<DynamiteResponse<BotSendMessageResponseApplicationJson, void>> sendMessage({
  required String message,
  required String token,
  String? referenceId,
  int? replyTo,
  int? silent,
  BotSendMessageApiVersion? apiVersion,
  bool? oCSAPIRequest,
}) async {
  final rawResponse = sendMessageRaw(
    message: message,
    token: token,
    referenceId: referenceId,
    replyTo: replyTo,
    silent: silent,
    apiVersion: apiVersion,
    oCSAPIRequest: oCSAPIRequest,
  );

  return rawResponse.future;
}