Message Metadata in iOS
Build out your message-specific metadata in iOS with Brand Messenger Legacy
Message metadata is a great way to convey information pertinent to the conversation. This information is forever tied to the message as it is sent, acting as a snapshot of details that can help the Agent and/or administrator.
Adding message metadata in iOS is a two-step process. Messages need to be pulled aside and the metadata added to the message before passing it along to Khoros Response. Here are the steps involved:
- Set the conversation's delegate (
KBMConversationDelegate)- In this example, it's set to the class that opens the messages screen, after
show()is called.
- In this example, it's set to the class that opens the messages screen, after
- Override the
willSendMessagefunction in the delegate file.
- This will intercept the message before it is sent, so developers can add a metadata dictionary into the message object.
-(void)startSecureMessaging:(UIButton*)sender { [BrandMessenger show]; [[BrandMessenger conversation] setDelegate:self]; } -(KBMMessage *)conversation:(KBMConversation*)conversation willSendMessage:(KBMMessage *)message { [message setMetadata:@{ @"MetadataOS": @"iOS", @"FieldTwo": @"Test" }]; return message; }func startSecureMessagging(_ sender: UIButton) { BrandMessenger.show() BrandMessenger.conversation()?.delegate = self } func conversation(_ conversation: KBMConversation, willSend message: KBMMessage) -> KBMMessage { message.metadata = ["MetadataOS": "iOS", "FieldTwo":"Test"] return message }
- In the Agent's Admin page, in Developer -> Metadata Visibility, add the Brand Messenger network in the Display Fields in Post section.

This will show the default fields likeclients[0].platform. You'll need to add your custom fields. This makes them visible under each message in the conversation under the Metadata section in Khoros Response Agent View.
Updated 4 months ago
Did this page help you?