To install using Package Manager
Wepin Widget Javascript SDK can be installed an an npm package.
Enter the following npm install
command in the terminal.
npm install @wepin/widget-sdk
Once the installation is complete, you can confirm that it has been added to the "dependencies" section in the package.json file.
{
"name": "wepin-widget-test-app",
"version": "1.0.0",
"description": "Wepin Widge Test App"
"main": "app.js",
"author": "honggildong@test.wepin.io",
"dependencies": {
"@wepin/widget-sdk": "^1.0.0"
}
}
Once the installation is complete, you can prepare to use Wepin by inserting your App ID and App Key and calling the init function as shown below.
// 1. import SDK
import '@wepin/widget-sdk'
const testAppKey = 'ak_test_ghq1D5s1sfG234sbnhdsw24mnovk313' // Test App Key
const testAppId = 'app_id_eg12sf3491azgs520' // Test App ID
// 2. Initialize
const Wepin = window.Wepin
const wepin = await Wepin.init(
testAppId,
testAppKey
)
To install using <script>
Tag
Add the JavaScript file to the HTML page where you want to integrate the Wepin widget.
Once the script is loaded, a Wepin
object is created in the global object (window), and you can use this object to proceed with initialization.
<head>
<title>Connect WEPIN<title>
<!-- 1. Add Script -->
<script src="https://cdn.jsdelivr.net/npm/@wepin/widget-sdk@1.0.0/dist/wepin-widget-sdk.min.js" defer async></script>
</head>
<script>
const testAppKey = 'ak_test_ghq1D5s1sfG234sbnhdsw24mnovk313' // Test App Key
const testAppId = 'app_id_eg12sf3491azgs520' // Test App ID
// 2. Initialize
const wepin = await Wepin.init(
testAppId,
testAppKey
)
</script>
Last updated