Skip to content

Commit 536daf0

Browse files
committed
add function for send email confirmation
1 parent 0a1d62f commit 536daf0

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ console.log(resultAllFollowing)
123123
* [.addStory(image)](#addStory)
124124
* [.getFollowingByDataUser(dataUser, size, cursor)](#getFollowingByDataUser)
125125
* [.sendDmByUsername(username, password, usernameReceiver, message)](#sendDmByUsername)
126+
* [.sendConfirmationEmail()](#sendConfirmationEmail)
126127

127128
### getCookie()
128129
```js
@@ -180,14 +181,16 @@ console.log(resultAllFollowing)
180181
### updateProfile(params)
181182
```js
182183
const payload = {
183-
biography: 'test update bio 1'
184+
biography: 'test update bio 1',
185+
184186
}
185187
const a = await InstaClient.updateProfile(payload)
186188
console.log(a)
187189
```
188190
> update profile. for now you can only update your bio.
189191
- `params`
190192
- `biography`: A `String`
193+
- `email`: A `String`
191194

192195
### getImageByUser(params)
193196
```js
@@ -479,6 +482,13 @@ console.log(resultAllFollowing)
479482
- `usernameReceiver`: A `Array` list username receiver message/dm
480483
- `message`: A `String` text message
481484

485+
### sendConfirmationEmail()
486+
```js
487+
await InstaClient.useExistingCookie();
488+
const sendConfirmationEmailResult = await InstaClient.sendConfirmationEmail();
489+
console.log(sendConfirmationEmailResult)
490+
```
491+
482492

483493
## License
484494

lib/index.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,19 +223,30 @@ class Instagram{
223223
}
224224

225225
async updateProfile({
226-
biography = ''
226+
biography = '',
227+
email = ''
227228
}){
228229
try{
229230
const oldData = await this.getProfileData();
230231
this.headers.referer = `${this.baseUrl}accounts/edit/`;
231-
const payload = `first_name=${oldData.first_name}&email=&username=${oldData.username}&phone_number=${oldData.phone_number}&biography=${biography || oldData.biography}&external_url=&chaining_enabled=on`;
232+
const payload = `first_name=${oldData.first_name}&email=${email ? email : oldData.email}&username=${oldData.username}&phone_number=${oldData.phone_number}&biography=${biography || oldData.biography}&external_url=&chaining_enabled=on`;
232233
const result = await this.requestNodeFetch.post(`${this.baseUrl}accounts/edit/`, payload, this.headers);
233234
return await result.json();
234235
}catch(e){
235236
throw new Error(e)
236237
}
237238
}
238239

240+
async sendConfirmationEmail(){
241+
try{
242+
this.headers.referer = `${this.baseUrl}`;
243+
const result = await this.requestNodeFetch.post(`${this.baseUrlZ4}accounts/send_confirm_email/`, '', this.headers);
244+
return await result.json();
245+
}catch(e){
246+
throw new Error(e)
247+
}
248+
}
249+
239250

240251

241252
async registerLastAttemp(phoneNumber, username, password, firstName){

0 commit comments

Comments
 (0)