Table of Contents

Interface IMessageSender

Namespace
Signal.Application.Abstractions
Assembly
Signal.Application.dll

Sends and deletes messages.

public interface IMessageSender

Methods

RemoteDeleteAsync(PhoneNumber, Recipient, long, CancellationToken)

Deletes a message the account sent earlier, for everyone in the conversation (DELETE /v1/remote-delete/{number}). Recipients see "This message was deleted".

Task<SendResult> RemoteDeleteAsync(PhoneNumber account, Recipient recipient, long targetTimestamp, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The account that sent the message.

recipient Recipient

The conversation the message was sent to (the group, or the direct-message recipient).

targetTimestamp long

The Timestamp of the message to delete.

cancellationToken CancellationToken

Cancels the request.

Returns

Task<SendResult>

The timestamp of the delete message itself.

Examples

var sent = await sender.SendAsync(account, OutgoingMessage.To(group).WithText("Oops").Build());
await sender.RemoteDeleteAsync(account, group, sent.Timestamp);

Remarks

Only the account's own messages can be deleted, and Signal clients honor remote deletes only for a limited time after sending. The default implementation throws NotSupportedException, so existing IMessageSender implementations keep compiling.

Exceptions

SignalApiException

The API rejected the delete.

NotSupportedException

The implementation does not support remote deletes.

SendAsync(PhoneNumber, OutgoingMessage, CancellationToken)

Sends a message (POST /v2/send).

Task<SendResult> SendAsync(PhoneNumber account, OutgoingMessage message, CancellationToken cancellationToken = default)

Parameters

account PhoneNumber

The sending account.

message OutgoingMessage

The message to send.

cancellationToken CancellationToken

Cancels the request.

Returns

Task<SendResult>

The timestamp of the sent message.

Exceptions

SignalApiException

The API rejected the message (e.g. unregistered recipient).