Skip to content

Cancel Scheduled Message

Delayed delivery as well as repeated publish messages can be canceled using the API documented below:

- (void)cancelScheduledMessageWithMessageId:(NSString * _Nonnull)messageId responseHandler:^(MessageStatus * _Nonnull)responseHandler errorHandler:^(Fault * _Nonnull)errorHandler;
func cancelScheduledMessage(messageId: String, responseHandler: ((MessageStatus) -> Void)!, errorHandler: ((Fault) -> Void)!)


Argument                Description
messageId ID of the message to cancel. Message ID must be obtained from the MessageStatus object obtained as the result of the Publish methods.

Return value

True is the scheduled message has been successfully canceled, false otherwise


The following errors may occur during the message cancellation API call. See the Error Handling section for details on how to retrieve the error code when the server returns an error:

Error Code
Message has already been canceled or does not exist.


[Backendless.shared.messaging cancelScheduledMessageWithMessageId:@"XXXXX" responseHandler:^(MessageStatus *messageStatus) {
    NSLog(@"Message has been cancelled: %@", messageStatus.messageId);
} errorHandler:^(Fault *fault) {
    NSLog(@"Error: %@", fault.message);
Backendless.shared.messaging.cancelScheduledMessage(messageId: "XXXXX", responseHandler: { messageStatus in
    print("Message has been cancelled: \(messageStatus.messageId ?? "")")
}, errorHandler: { fault in
    print("Error: \(fault.message ?? "")")