📘

Don't have an Instabot account yet?

Start your free trial today!

Overview

Instabot can be integrated into your native iOS app using a full-screen webview.

Instabot launching in a native iOS webviewInstabot launching in a native iOS webview

Instabot launching in a native iOS webview

Contents

  1. Get your bot microsite URL
  2. Create a full-screen webview

1. Get your bot microsite URL

  1. In the conversations page, find the bot that you want to launch, open the menu, then click 'Share'
Get your bot's microsite URLGet your bot's microsite URL

Get your bot's microsite URL

  1. Copy the microsite URL from the page that's launched. You'll need this for the next step!

2. Create a full-screen webview

  1. In your app, create a full-screen webview that will launch your bot's microsite URL
import UIKit
import WebKit

// replace with your own bot microsite URL
let botUrl = "https://YOUR-BOTS-MICROSITE-URL"

class WebViewController: UIViewController {

    @IBOutlet weak var webView: WKWebView!
    
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        guard let url = URL(string: botUrl) else {
            webView.loadHTMLString("<H1>Bot URL is incorrect</H1>", baseURL: nil)
            return
        }
        webView.load(URLRequest(url: url))
    }
}
  1. That's it!