DeskPro iOS Messenger is a Chat/AI/Messaging product. You can embed a “widget” directly into native app, so that enables end-users to use the product. Similar implementation for Android.
- iOS 11.0+
- Swift 5.7+
- Xcode 14.0+
- File > Swift Packages > Add Package Dependency
- Add
https://github.com/deskpro/messenger-sdk-ios
- Select "Up to Next Major" version
Although we recommend using SPM, it is also possible to clone this repository manually, and drag and drop it into the root folder of the application.
First, import the SDK:
import messenger_sdk_ios
Then, in your ViewController:
let messengerConfig = MessengerConfig(appUrl: "YOUR_APP_URL", appId: "YOUR_APP_ID")
var messenger: DeskPro?
Replace YOUR_APP_URL
and YOUR_APP_ID
with your app's URL and ID.
override func viewDidLoad() {
super.viewDidLoad()
messenger = DeskPro(messengerConfig: messengerConfig, containingViewController: self)
}
To open a Messenger, paste this line example in the desired place:
messenger?.present().show()
First, import the SDK:
@import messenger_sdk_ios;
Then, in your ViewController.h:
@property (strong, nonatomic) MessengerConfig *messengerConfig;
@property (strong, nonatomic) DeskPro *messenger;
Then, in your ViewController.m:
- (void)viewDidLoad {
[super viewDidLoad];
self.messengerConfig = [[MessengerConfig alloc] initWithAppUrl:@"YOUR_APP_URL" appId:@"YOUR_APP_ID" appKey:@"YOUR_APP_KEY"];
self.messenger = [[DeskPro alloc] initWithMessengerConfig:self.messengerConfig containingViewController:self enableAutologging:false];
}
Replace YOUR_APP_URL
and YOUR_APP_ID
with your app's URL and ID, and YOUR_APP_KEY
with you app's KEY, or nil.
To open a Messenger, paste this line example in the desired place:
[[self.messenger present] show];
Note: You can create multiple Messenger instances.
messenger?.setUserInfo(user: userObject)
[self.messenger setUserInfoWithUser:userObject];
Note: User(name, firstName, lastName, email)
messenger?.authorizeUser(jwtToken: jwtToken)
[self.messenger authorizeUserWithUserJwt:jwtToken];
messenger?.setPushRegistrationToken(token: token)
[self.messenger setPushRegistrationTokenWithToken:token];
Prerequisite: The application should be connected to the notifications platform, enabled for receiving notifications and obtaining tokens.
In order to make the file upload and download fully work, make sure to add these permissions with appropriate messages in your Info.plist
file:
- Privacy - Camera Usage Description
- Privacy - Microphone Usage Description
- Privacy - Photo Library Additions Usage Description
We use SemVer for versioning. For the versions available, see the tags on this repository.