You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-1Lines changed: 10 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,6 +79,7 @@ Place the `IntercomProvider` as high as possible in your application. This will
79
79
| onHide | () => void | triggered when the Messenger hides | false ||
80
80
| onShow | () => void | triggered when the Messenger shows | false ||
81
81
| onUnreadCountChange | (number) => void | triggered when the current number of unread messages changes | false ||
82
+
| onUserEmailSupplied | () => void | triggered when a visitor enters their email into the Messenger | false ||
82
83
| shouldInitialize | boolean | indicates if the Intercom should be initialized. Can be used in multistaged environment | false | true |
83
84
| apiBase | string | If you need to route your Messenger requests through a different endpoint than the default. Generally speaking, this is not needed.<br/> Format: `https://${INTERCOM_APP_ID}.intercom-messenger.com` (See: [https://github.com/devrnt/react-use-intercom/pull/96](https://github.com/devrnt/react-use-intercom/pull/96)) | false ||
84
85
| initializeDelay | number | Indicates if the intercom initialization should be delayed, delay is in ms, defaults to 0. See https://github.com/devrnt/react-use-intercom/pull/236| false ||
@@ -95,13 +96,17 @@ const App = () => {
95
96
console.log('Intercom has a new unread message');
96
97
setUnreadMessagesCount(amount);
97
98
};
99
+
constonUserEmailSupplied= () => {
100
+
console.log('Visitor has entered email');
101
+
};
98
102
99
103
return (
100
104
<IntercomProvider
101
105
appId={INTERCOM_APP_ID}
102
106
onHide={onHide}
103
107
onShow={onShow}
104
108
onUnreadCountChange={onUnreadCountChange}
109
+
onUserEmailSupplied={onUserEmailSupplied}
105
110
autoBoot
106
111
>
107
112
<p>Hi there, I am a child of the IntercomProvider</p>
@@ -134,6 +139,7 @@ Used to retrieve all methods bundled with Intercom. These are based on the offic
134
139
| startTour | (tourId: number) => void | starts a tour based on the `tourId`|
135
140
| trackEvent | (event: string, metaData?: object) => void | submits an `event` with optional `metaData`
136
141
| showArticle | (articleId: string) => void | opens the Messenger with the specified article by `articleId`
142
+
| startSurvey | (surveyId: number) => void | Trigger a survey in the Messenger by `surveyId`
137
143
138
144
#### Example
139
145
```javascript
@@ -162,7 +168,8 @@ const HomePage = () => {
162
168
getVisitorId,
163
169
startTour,
164
170
trackEvent,
165
-
showArticle
171
+
showArticle,
172
+
startSurvey
166
173
} =useIntercom();
167
174
168
175
constbootWithProps= () =>boot({ name:'Russo' });
@@ -177,6 +184,7 @@ const HomePage = () => {
177
184
name:'Russo',
178
185
});
179
186
consthandleShowArticle= () =>showArticle(123456);
187
+
consthandleStartSurvey= () =>startSurvey(123456);
180
188
181
189
return (
182
190
<>
@@ -200,6 +208,7 @@ const HomePage = () => {
200
208
Track eventwith metadata
201
209
</button>
202
210
<button onClick={handleShowArticle}>Open article in Messenger</button>
211
+
<button onClick={handleStartSurvey}>Start survey in Messenger</button>
Copy file name to clipboardExpand all lines: packages/react-use-intercom/README.md
+10-1Lines changed: 10 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,6 +79,7 @@ Place the `IntercomProvider` as high as possible in your application. This will
79
79
| onHide | () => void | triggered when the Messenger hides | false ||
80
80
| onShow | () => void | triggered when the Messenger shows | false ||
81
81
| onUnreadCountChange | (number) => void | triggered when the current number of unread messages changes | false ||
82
+
| onUserEmailSupplied | () => void | triggered when a visitor enters their email into the Messenger | false ||
82
83
| shouldInitialize | boolean | indicates if the Intercom should be initialized. Can be used in multistaged environment | false | true |
83
84
| apiBase | string | If you need to route your Messenger requests through a different endpoint than the default. Generally speaking, this is not needed.<br/> Format: `https://${INTERCOM_APP_ID}.intercom-messenger.com` (See: [https://github.com/devrnt/react-use-intercom/pull/96](https://github.com/devrnt/react-use-intercom/pull/96)) | false ||
84
85
| initializeDelay | number | Indicates if the intercom initialization should be delayed, delay is in ms, defaults to 0. See https://github.com/devrnt/react-use-intercom/pull/236| false ||
@@ -95,13 +96,17 @@ const App = () => {
95
96
console.log('Intercom has a new unread message');
96
97
setUnreadMessagesCount(amount);
97
98
};
99
+
constonUserEmailSupplied= () => {
100
+
console.log('Visitor has entered email');
101
+
};
98
102
99
103
return (
100
104
<IntercomProvider
101
105
appId={INTERCOM_APP_ID}
102
106
onHide={onHide}
103
107
onShow={onShow}
104
108
onUnreadCountChange={onUnreadCountChange}
109
+
onUserEmailSupplied={onUserEmailSupplied}
105
110
autoBoot
106
111
>
107
112
<p>Hi there, I am a child of the IntercomProvider</p>
@@ -134,6 +139,7 @@ Used to retrieve all methods bundled with Intercom. These are based on the offic
134
139
| startTour | (tourId: number) => void | starts a tour based on the `tourId`|
135
140
| trackEvent | (event: string, metaData?: object) => void | submits an `event` with optional `metaData`
136
141
| showArticle | (articleId: string) => void | opens the Messenger with the specified article by `articleId`
142
+
| startSurvey | (surveyId: number) => void | Trigger a survey in the Messenger by `surveyId`
137
143
138
144
#### Example
139
145
```javascript
@@ -162,7 +168,8 @@ const HomePage = () => {
162
168
getVisitorId,
163
169
startTour,
164
170
trackEvent,
165
-
showArticle
171
+
showArticle,
172
+
startSurvey
166
173
} =useIntercom();
167
174
168
175
constbootWithProps= () =>boot({ name:'Russo' });
@@ -177,6 +184,7 @@ const HomePage = () => {
177
184
name:'Russo',
178
185
});
179
186
consthandleShowArticle= () =>showArticle(123456);
187
+
consthandleStartSurvey= () =>startSurvey(123456);
180
188
181
189
return (
182
190
<>
@@ -200,6 +208,7 @@ const HomePage = () => {
200
208
Track eventwith metadata
201
209
</button>
202
210
<button onClick={handleShowArticle}>Open article in Messenger</button>
211
+
<button onClick={handleStartSurvey}>Start survey in Messenger</button>
0 commit comments