Facebook Messenger SDK in Swift, how to reply in messenger and direct user to my app.

862 views Asked by At

In FBMessenger when user clicks to reply using the special reply link right below the image/video that was sent from my app the user is re-directed to my app in the app store even though the app is already installed. How do I direct the user directly to my app from FBMessenger reply link?

When this is achieved I would like the user to select image/video in my app and when reply/send is selected redirect back to FBMessenger on the same thread they were on to quickly reply. Current result is sending a new message, after "send" from my app the user is redirected to messenger and have to select who to send it to like a new message.

This is what I have according to https://developers.facebook.com/docs/messenger/ios. But when I run the app these delegate functions are not being called. Any ideas? Thank you.

class AppDelegate: UIResponder, UIApplicationDelegate, FBSDKMessengerURLHandlerDelegate {

    var contextFBMessenger : FBSDKMessengerContext?;
    let messengerUrlHandler = FBSDKMessengerURLHandler()

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
            messengerUrlHandler.delegate = self
            return true;
    }

    func messengerURLHandler(messengerURLHandler: FBSDKMessengerURLHandler!, didHandleOpenFromComposerWithContext context: FBSDKMessengerURLHandlerOpenFromComposerContext!) {
        self.contextFBMessenger = context
    }

    func messengerURLHandler(messengerURLHandler: FBSDKMessengerURLHandler!, didHandleReplyWithContext context: FBSDKMessengerURLHandlerReplyContext!) {
        self.contextFBMessenger = context
    }

}
0

There are 0 answers