Search…
Integrate the Email SDK
Integrate the Email SDK into your application

Prerequisites

Get Started

Integrate the JS SDK

To use the Email SDK in a Web or Node.js project, you must add @sudoplatform/sudo-email as a dependency to your project.
1
yarn add '@sudoplatform/sudo-email'
2
# or
3
npm install --save '@sudoplatform/sudo-email'
Copied!
In order to instantiate an Email client, make sure you have followed instructions for Getting Started, User SDK and Sudo Profiles SDK (see Prerequisites above).
To instantiate and initialize a client in your application, add the following:
TypeScript
1
import { DefaultApiClientManager } from '@sudoplatform/sudo-api-client'
2
import { DefaultConfigurationManager } from '@sudoplatform/sudo-common'
3
import { DefaultSudoEmailClient } from '@sudoplatform/sudo-email'
4
import { DefaultSudoProfilesClient } from '@sudoplatform/sudo-profiles'
5
import { DefaultSudoUserClient } from '@sudoplatform/sudo-user'
6
7
const sdkConfigJSON = /* ... refer to Users documentation ... */
8
DefaultConfigurationManager.getInstance().setConfig(sdkConfigJSON)
9
10
const userClient = new DefaultSudoUserClient(/* refer to Users documentation */)
11
const profilesClient = new DefaultSudoProfilesClient(/* refer to Sudos documentation */)
12
const apiClientManager = DefaultApiClientManager.getInstance().setAuthClient(userClient)
13
14
const emailClient = new SudoEmailClient(
15
apiClientManager
16
userClient,
17
profilesClient,
18
)
Copied!

Integrate the iOS SDK

Add this line to your Podfile:
1
pod 'SudoEmail'
Copied!
Install pod dependencies by running the following command in your project directory:
1
pod install --repo-update
Copied!
This will update the local CocoaPods repository and install the latest version of the Email SDK.
In order to instantiate an Email client, make sure you have followed instructions for Getting Started, User SDK and Sudo Profiles SDK (see Prerequisites above)
To instantiate a client in your application, add the following:
Swift
1
import SudoEmail
2
3
let userClient = // ... see "Users" docs
4
let profilesClient = // ... see "Sudos" docs
5
6
let emailClient = try DefaultSudoEmailClient(
7
sudoUserClient: userClient,
8
sudoProfilesClient: profilesClient
9
)
Copied!
You only need one client instance for a given user per device. Instantiating multiple clients with the same configuration and using them at the same time may cause unexpected runtime errors to occur.
See it in action. Be sure to take a look at the open source iOS sample app on GitHub that our team published as a reference for integrating the Email SDK into your app as quickly and seamlessly as possible.

Integrate the Android SDK

The Android SDK is open source and compatible with Android 6 (API level 23) and above.
Gradle
Add this line to the dependencies section of the app module build.gradle and synchronize your project with Android Studio.
1
dependencies {
2
implementation 'com.sudoplatform:sudoemail:$latest_version'
3
}
Copied!
The latest version of the SDK can be found at SDK Releases.
In order to instantiate an Email client, make sure you have followed instructions for Getting Started, User SDK and Sudo Profiles SDK (see Prerequisities above)
To instantiate a client in your application, add the following:
Kotlin
1
val userClient = // ... see "Users" docs
2
val profilesClient = // ... see "Sudos" docs
3
4
val emailClient = SudoEmailClient.builder()
5
.setContext(appContext)
6
.setSudoUserClient(userClient)
7
.setSudoProfilesClient(sudoClient)
8
.build()
Copied!
You only need one client instance for a given user per device. Instantiating multiple clients with the same configuration and using them at the same time may cause unexpected runtime errors to occur.
See it in action. Be sure to take a look at the open source Android sample app on Github that our team published as a reference for integrating the Email SDK into your app as quickly and seamlessly as possible.
Last modified 21d ago