
电容对讲机
@capacitor-community/intercom
启用Intercom 能力的电容社区插件
维护者
| 维护者 | GitHub 图像 | 社会 |
|---|---|---|
| 斯特万·席尔瓦 | 炖鱼 | @stewones (英语) |
兼容性
| 电容 | 对讲机iOS | Intercom Android 软件 | iOS 目标 | Android 目标 |
|---|---|---|---|---|
| 8.x 电话 | 18.x 国家 | 17.x (中文(简体) ) | 15.0 (韩语) | 第36条 |
| 7.x 电话 | 18.x 国家 | 15.x (中文(简体) ) | 15.0 (韩语) | 35个 |
| 6.x (单位:千美元) | 16.x (韩语) | 12.x (中文(简体) ) | 13.0 (韩语) | 页:1 |
说明: 此插件跟随语义版本 电容 并保持与Intercom SDKs的兼容性(iOS系统, (中文(简体) ), 机器人) (中文(简体) ). 如果你遇到任何问题 因为版本不一致,请 打开一个问题 帮助我们改进插件.
安装
使用 npm :
npm install @capacitor-community/intercom
使用线条 :
yarn add @capacitor-community/intercom
同步本地文件 :
npx cap sync
使用量
import { Intercom } from '@capacitor-community/intercom';
import { PushNotifications } from '@capacitor/push-notifications';
// Register for push notifications from Intercom
PushNotifications.register();
// Register an identified user
Intercom.registerIdentifiedUser({ userId: 123456 });
Intercom.registerIdentifiedUser({ email: '[email protected]' });
Intercom.registerIdentifiedUser({ userId: 123456, email: '[email protected]' });
// Register a log event
Intercom.logEvent({ name: 'my-event', data: { pi: 3.14 } });
// Display the message composer
Intercom.displayMessageComposer({ message: 'Hello there!' });
// Identity Verification
// https://developers.intercom.com/installing-intercom/docs/ios-identity-verification
Intercom.setUserHash({ hmac: 'xyz' });
// Secure Your Messenger
// https://developers.intercom.com/installing-intercom/ios/secure-your-messenger
Intercom.setUserJwt({ jwt: 'xyz' });
iOS 设置
ionic start my-cap-app --capacitorcd my-cap-appnpm install @capacitor-community/intercommkdir www && touch www/index.htmlnpx cap add ios- 在电容器的配置文件上添加接口密钥
{
…
"plugins": {
"Intercom": {
"iosApiKey": "ios_sdk-xxx",
"iosAppId": "yyy"
}
}
…
}
npx cap open ios- 在 xcode( 一般标签) 签名您的应用程序
提示:每次您更改本地代码时, 您可能需要清理缓存( Product > Clean building文件夹) , 然后再次运行应用程序 .
机器人设置
ionic start my-cap-app --capacitorcd my-cap-appnpm install @capacitor-community/intercommkdir www && touch www/index.htmlnpx cap add android- 在电容器的配置文件上添加接口密钥
{
…
"plugins": {
"Intercom": {
"androidApiKey": "android_sdk-xxx",
"androidAppId": "yyy"
}
}
…
}
npx cap open android
现在你该走了 尝试使用 ionic cap run android --livereload。 。 。 .
提示:每次您更改本地代码, 您可能需要清理缓存( Build > Clean Project QQ Build > Rebuilt Project) , 然后再次运行应用程序 .
API 密码
loadWithKeys(...)registerIdentifiedUser(...)registerUnidentifiedUser()updateUser(...)logout()logEvent(...)displayMessenger()displayMessageComposer(...)displayHelpCenter()hideMessenger()displayLauncher()hideLauncher()displayInAppMessages()hideInAppMessages()displayCarousel(...)setUserHash(...)setUserJwt(...)setBottomPadding(...)sendPushTokenToIntercom(...)receivePush(...)displayArticle(...)addListener('windowDidShow', ...)addListener('windowDidHide', ...)removeAllListeners()- 接口
装入 Keys (...)
loadWithKeys(options: { appId?: string; apiKeyIOS?: string; apiKeyAndroid?: string; }) => Promise<void>
| 参数 | 类型 |
|---|---|
options | { appId?: string; apiKeyIOS?: string; apiKeyAndroid?: string; } |
注册识别用户(...)
registerIdentifiedUser(options: { userId?: string; email?: string; }) => Promise<void>
| 参数 | 类型 |
|---|---|
options | { userId?: string; email?: string; } |
未识别用户 ()
registerUnidentifiedUser() => Promise<void>
更新用户(...)
updateUser(options: IntercomUserUpdateOptions) => Promise<void>
| 参数 | 类型 |
|---|---|
options | IntercomUserUpdateOptions |
登录( c)
logout() => Promise<void>
日志事件(...)
logEvent(options: { name: string; data?: any; }) => Promise<void>
| 参数 | 类型 |
|---|---|
options | { name: string; data?: any; } |
显示信使( )
displayMessenger() => Promise<void>
显示MessageComposer (...)
displayMessageComposer(options: { message: string; }) => Promise<void>
| 参数 | 类型 |
|---|---|
options | { message: string; } |
显示帮助中心( C)
displayHelpCenter() => Promise<void>
隐藏信使( C)
hideMessenger() => Promise<void>
显示 Launcher ()
displayLauncher() => Promise<void>
隐藏 Launcher ()
hideLauncher() => Promise<void>
显示 ImpMessages ()
displayInAppMessages() => Promise<void>
隐藏 InAppMessages ()
hideInAppMessages() => Promise<void>
显示 Carousel (...)
displayCarousel(options: { carouselId: string; }) => Promise<void>
| 参数 | 类型 |
|---|---|
options | { carouselId: string; } |
设置 UserHash (...)
setUserHash(options: { hmac: string; }) => Promise<void>
| 参数 | 类型 |
|---|---|
options | { hmac: string; } |
设置用户Jwt(...)
setUserJwt(options: { jwt: string; }) => Promise<void>
| 参数 | 类型 |
|---|---|
options | { jwt: string; } |
设置 BottomPadding(...)
setBottomPadding(options: { value: string; }) => Promise<void>
| 参数 | 类型 |
|---|---|
options | { value: string; } |
发送 PushTokenTo Intercom (...)
sendPushTokenToIntercom(options: { value: string; }) => Promise<void>
| 参数 | 类型 |
|---|---|
options | { value: string; } |
接收 Push (...)
receivePush(notification: IntercomPushNotificationData) => Promise<void>
| 参数 | 类型 |
|---|---|
notification | IntercomPushNotificationData |
显示文章(...)
displayArticle(options: { articleId: string; }) => Promise<void>
| 参数 | 类型 |
|---|---|
options | { articleId: string; } |
添加倾听器( '窗口显示',...)
addListener(eventName: 'windowDidShow', listenerFunc: () => void) => Promise<PluginListenerHandle>
| 参数 | 类型 |
|---|---|
eventName | 'windowDidShow' |
listenerFunc | () => void |
回返情况: Promise<PluginListenerHandle>
添加倾听器( '窗口隐藏',...)
addListener(eventName: 'windowDidHide', listenerFunc: () => void) => Promise<PluginListenerHandle>
| 参数 | 类型 |
|---|---|
eventName | 'windowDidHide' |
listenerFunc | () => void |
回返情况: Promise<PluginListenerHandle>
删除所有收听器( )
removeAllListeners() => Promise<void>
接口
用户间更新选项
| Prop | 类型 |
|---|---|
userId | string |
email | string |
name | string |
phone | string |
languageOverride | string |
customAttributes | { [key: string]: any; } |
互通通知数据
| Prop | 类型 |
|---|---|
conversation_id | string |
message | string |
body | string |
author_name | string |
image_url | string |
app_name | string |
receiver | string |
conversation_part_type | string |
intercom_push_type | string |
uri | string |
push_only_conversation_id | string |
instance_id | string |
title | string |
priority | number |
插件听筒
| Prop | 类型 |
|---|---|
remove | () => Promise<void> |
通知
我们从一个正式的Ong开始 如果您使用上一个 npm 软件包 capacitor-intercom请更新您的软件包 @capacitor-community/intercom检查 更改日志 需要更多信息.
从 Capacitor v2 切换到 v3
UserUpdateOptions选项类型变为IntercomUserUpdateOptionsIntercomPlugin配置密钥变为Intercomandroid-apiKey配置密钥变为androidApiKeyandroid-appId配置密钥变为androidAppIdios-apiKey配置密钥变为iosApiKeyios-appId配置密钥变为iosAppId- 从 CAPBridge 切换到应用程序DelegateProxy 应用事件
- 从您的应用程序中删除整个创建初始化
MainActivity.java
public class MainActivity extends BridgeActivity {
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- // Initializes the Bridge
- this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
- // Additional plugins you've installed go here
- add(IntercomPlugin.class);
- }});
- }
}
许可证
麻省理工学院
示例
贡献者
感谢这些伟大的人emoji 密钥:
缝 💻 📖 |
大卫 寻找 💻 |
罗马尼基丁 💻 |
安妮·托马索尼 💻 👀 |
迈凯伊·莫泽列夫斯基 💻 |
奥列格·尤兹维克 🚧 |
古斯塔沃·科里亚·阿尔维斯 📖 |
捷尔维亚 🚧 |
亚当·杜伦 💻 🚧 |
拉米・哈法吉 💻 |
坂原正彦 🚧 |
德雅尔丁·卡米尔 💻 |
穆罕默德·阿卜杜勒格瓦德 🚧 |
内森 🚧 |
塞西尔·沃克 💻 🚧 |
Pavlo 派里格语Name 💻 |
鲁恩 💻 |
瑞克・杰伦 🚧 |
换行 📖 |
菲利普物质 💻 |
乔希·派克 🚧 |
虚拟媒体 💻 |
本项目遵循 全部贡献者 规格。 任何捐款都欢迎!