Forward messages

The message forwarding feature lets you resend published messages or conversations to:

  • Share relevant information - you can forward messages or threads with additional relevant context to other users, ensuring efficient knowledge sharing.

  • Collaborate and consult - forwarding messages helps in decision-making by involving those who may have valuable insights and can contribute to ongoing discussions or projects.

You can let users send a given message from one channel to another with Forward() and ForwardMessage().

icon

Usage in Blueprints and C++


All of them give the same output. The only difference is that you call a given method either directly on the message (Forward()) or the channel or the chat (ForwardMessage()) object. Depending on the object, these methods take different input parameters.

Additional info in the forwarded message

Each forwarded message contains additional metadata: originalPublisher with the user ID of the person who originally published the message (to track its owner) and originalChannelId with the ID of the channel where the message was originally published.

Method signature

Output

These methods don't return any value.

Basic usage

Forward a message from the support channel to the incident-management channel.

  • Forward()


    #include "Kismet/GameplayStatics.h"
    #include "PubnubChatSubsystem.h"

    UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
    UPubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>();

    UPubnubChat* Chat = PubnubChatSubsystem ->InitChat("demo", "demo", "my_user");

    UPubnubChannel* Channel = Chat->GetChannel("support");

    FString Timetoken = "16200000000000001";

    // Fetch the message
    UPubnubMessage* Message = Channel->GetMessage(Timetoken);
    show all 17 lines
  • ForwardMessage()

    #include "Kismet/GameplayStatics.h"
    #include "PubnubChatSubsystem.h"

    UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
    UPubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>();

    UPubnubChat* Chat = PubnubChatSubsystem ->InitChat("demo", "demo", "my_user");

    UPubnubChannel* Channel = Chat->GetChannel("support");
    UPubnubChannel* Channel2 = Chat->GetChannel("incident-management");

    FString Timetoken = "16200000000000001";

    // Fetch the message
    UPubnubMessage* Message = Channel->GetMessage(Timetoken);
    show all 17 lines
Last updated on