Skip to content

SendMessageRequestBuilder

Namespace: Signal.Bot

Full Name: Signal.Bot.SendMessageRequestBuilder

Summary

Provides a fluent interface for constructing SendMessageRequest objects with various message properties and configurations.

Methods

Create

csharp
Create(number)

Creates a new instance of the SendMessageRequestBuilder.

Parameters:

  • number - The sender's phone number in international format.

Returns: A new SendMessageRequestBuilder instance.

WithAttachmentFromFile

csharp
WithAttachmentFromFile(filePath, includeFilename)

Adds an attachment from a file path, automatically encoding it as base64 with the appropriate MIME type.

Parameters:

  • filePath - The path to the file to attach.
  • includeFilename - If true, includes the filename in the data URI. Default is false.

Returns: The builder instance for method chaining.

WithAttachmentFromBytes

csharp
WithAttachmentFromBytes(bytes, mimeType, filename)

Adds an attachment from a byte array with the specified MIME type and optional filename.

Parameters:

  • bytes - The byte array containing the attachment data.
  • mimeType - The MIME type of the attachment (e.g., "image/png", "application/pdf").
  • filename - Optional filename to include in the data URI.

Returns: The builder instance for method chaining.

WithAttachment

csharp
WithAttachment(attachment)

Adds a base64-encoded attachment to the message.

Parameters:

  • attachment - The base64-encoded attachment string or data URI.

Returns: The builder instance for method chaining.

WithEditTimestamp

csharp
WithEditTimestamp(editTimestamp)

Sets the timestamp for editing an existing message.

Parameters:

  • editTimestamp - The timestamp of the message to edit.

Returns: The builder instance for method chaining.

WithLinkPreview

csharp
WithLinkPreview(linkPreview)

Sets the link preview configuration for the message.

Parameters:

  • linkPreview - The link preview configuration object.

Returns: The builder instance for method chaining.

WithLinkPreview

csharp
WithLinkPreview(url, title, description, thumbnail)

Creates and sets a link preview with the specified properties.

Parameters:

  • url - The URL to preview.
  • title - Optional title for the link preview.
  • description - Optional description for the link preview.
  • thumbnail - Optional thumbnail image as a byte array.

Returns: The builder instance for method chaining.

WithMentions

csharp
WithMentions(mentions, overwrite)

Sets the mentions in the message, either overwriting existing mentions or appending to them.

Parameters:

  • mentions - The collection of mentions to add.
  • overwrite - If true, replaces existing mentions; if false, appends to them. Default is true.

Returns: The builder instance for method chaining.

WithMention

csharp
WithMention(mention)

Adds a single mention to the message.

Parameters:

  • mention - The mention to add.

Returns: The builder instance for method chaining.

WithMention

csharp
WithMention(author, start, length)

Adds a mention with the specified author and position in the message text.

Parameters:

  • author - The phone number or identifier of the user being mentioned.
  • start - The zero-based starting character position of the mention in the message text.
  • length - The length of the mention text in characters.

Returns: The builder instance for method chaining.

WithMessage

csharp
WithMessage(message)

Sets the message text content.

Parameters:

  • message - The text content of the message.

Returns: The builder instance for method chaining.

WithNotifySelf

csharp
WithNotifySelf(notifySelf)

Sets whether the sender should receive a notification for their own message.

Parameters:

  • notifySelf - If true, the sender receives a notification for this message. Default is true.

Returns: The builder instance for method chaining.

WithQuoteAuthor

csharp
WithQuoteAuthor(quoteAuthor)

Sets the author of the quoted message when replying.

Parameters:

  • quoteAuthor - The phone number or identifier of the quoted message's author.

Returns: The builder instance for method chaining.

WithQuoteMentions

csharp
WithQuoteMentions(quoteMentions, overwrite)

Sets the mentions in the quoted message, either overwriting existing quote mentions or appending to them.

Parameters:

  • quoteMentions - The collection of mentions in the quoted message.
  • overwrite - If true, replaces existing quote mentions; if false, appends to them. Default is true.

Returns: The builder instance for method chaining.

WithQuoteMention

csharp
WithQuoteMention(mention)

Adds a single mention to the quoted message.

Parameters:

  • mention - The mention in the quoted message.

Returns: The builder instance for method chaining.

WithQuoteMessage

csharp
WithQuoteMessage(quoteMessage)

Sets the text content of the message being quoted or replied to.

Parameters:

  • quoteMessage - The text of the quoted message.

Returns: The builder instance for method chaining.

WithQuoteTimestamp

csharp
WithQuoteTimestamp(quoteTimestamp)

Sets the timestamp of the message being quoted or replied to.

Parameters:

  • quoteTimestamp - The timestamp of the quoted message.

Returns: The builder instance for method chaining.

WithRecipients

csharp
WithRecipients(recipients, overwrite)

Sets the recipients of the message, either overwriting existing recipients or appending to them.

Parameters:

  • recipients - The collection of recipient phone numbers or group IDs.
  • overwrite - If true, replaces existing recipients; if false, appends to them. Default is true.

Returns: The builder instance for method chaining.

WithRecipient

csharp
WithRecipient(recipient)

Adds a single recipient to the message.

Parameters:

  • recipient - The phone number or group ID of the recipient.

Returns: The builder instance for method chaining.

WithSticker

csharp
WithSticker(sticker)

Sets a sticker to be sent with the message.

Parameters:

  • sticker - The sticker identifier or base64-encoded sticker data.

Returns: The builder instance for method chaining.

WithTextMode

csharp
WithTextMode(textMode)

Sets the text formatting mode for the message.

Parameters:

  • textMode - The text mode defining how the message should be formatted.

Returns: The builder instance for method chaining.

WithViewOnce

csharp
WithViewOnce(viewOnce)

Sets whether the message should be viewable only once before disappearing.

Parameters:

  • viewOnce - If true, the message can only be viewed once. Default is true.

Returns: The builder instance for method chaining.

Build

csharp
Build()

Builds and returns the configured SendMessageRequest.

Returns: The configured SendMessageRequest instance.