Overview
If presenting Messenger using SDK sometimes you will not see messenger history when you log. For instance, logging into Messenger on your phone, sending a message, then log out. When you log back in, the previous message is not there. The article shows the process to resolve this.
Process
- The Messenger SDK is storing the last conversations initiated by Clients. These conversations are stored at the server end.
- While initializing the SDK it fetches the earlier conversation from the server. The API which is used to fetch the conversation is mentioned below:
https://YOUR_DOMAIN/api/v1/conversations?limit=100&include=read_marker,user_minimal
- The parameter to include in header field in the key value form:
- X-Fingerprint-ID : A3D141B2-AB60-44DB-B46C-xxxxxxxxx
- Based on the above request you will get a list of conversations.
- After that, if the user wants to continue the conversation, a second API with all information related to the conversation. Below is the API:
https://YOUR_DOMAIN/api/v1/conversations/1062/messages?limit=100&include=attachment,user_minimal
- The parameter to include in header field in the key value form:
- X-Fingerprint-ID : A3D141B2-AB60-44DB-B46C-xxxxxxxxx
- Note: All these steps are already done in SDK you only have to integrate the SDK and present the CustomerSuccessController.
- Sample code to present the messenger:
let config = Configuration(brandName: "Kayako", instanceURL: URL(string: “YOUR_DOMAIN”)!, authorization: .auto, background: .patternGradient(BackgroundPattern.confetti.image(tone: .light), GradientColor.eggPlant.colors), primaryColor: UIColor(red:0.95, green:0.44, blue:0.25, alpha:1.00), homeTitle: "Good Morning ☕️", homeSubtitle: "The real coffee experts. How can we help?", homeTextColor: .white)
let conversationNav = CustomerSuccessController(config: config)
conversationNav.modalPresentationStyle = .custom
let cardTransitionDelegate = CardTransitioningDelegate()
conversationNav.transitioningDelegate = cardTransitionDelegate
viewController.present(conversationNav, animated: true) { }