Use the HubSpot mobile chat SDK to integrate your iOS mobile application with HubSpot’s live chat functionality.
xcodebuild
, you may need to specify the -scmProvider system
or -scmProvider xcode
arguments to choose whether your system git credentials or xcode credentials are used.HubSpot-Info.plist config
file in your project, then mark it as included in the app target.
During app startup, or in another suitable location in your app’s code where you initialize your app components, call the configure method on the SDK.
HubSpotChatView.init(manager:pushData:chatFlow:)
method, using either default values or with customized chat settings.
.sheet
modifier, in response to a user action such as tapping a button.
$showChat
is a state property in the view:
UIHostingController
. For example, you can present the chat view from a UIViewController button action.
HubspotManager/setUserIdentity(identityToken:email:)
. This should be called before opening a chat view.
HubspotManager/setChatProperties(data:)
method and provide the associated key and value you want to set. This is best called before starting a chat, and will apply to all new chats. You could set an account status, or other identifiers when setting up your user. These will then appear in all chats opened for the remainder of the app launch.
For example, the following code would set several pre-defined permissions and custom properties:
HubspotManager/clearUserData()
at an appropriate time in your app.