Skip to content

Commit

Permalink
add function for send email confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
M1n007 committed Dec 31, 2020
1 parent 0a1d62f commit 536daf0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ console.log(resultAllFollowing)
* [.addStory(image)](#addStory)
* [.getFollowingByDataUser(dataUser, size, cursor)](#getFollowingByDataUser)
* [.sendDmByUsername(username, password, usernameReceiver, message)](#sendDmByUsername)
* [.sendConfirmationEmail()](#sendConfirmationEmail)

### getCookie()
```js
Expand Down Expand Up @@ -180,14 +181,16 @@ console.log(resultAllFollowing)
### updateProfile(params)
```js
const payload = {
biography: 'test update bio 1'
biography: 'test update bio 1',
email: '[email protected]'
}
const a = await InstaClient.updateProfile(payload)
console.log(a)
```
> update profile. for now you can only update your bio.
- `params`
- `biography`: A `String`
- `email`: A `String`

### getImageByUser(params)
```js
Expand Down Expand Up @@ -479,6 +482,13 @@ console.log(resultAllFollowing)
- `usernameReceiver`: A `Array` list username receiver message/dm
- `message`: A `String` text message

### sendConfirmationEmail()
```js
await InstaClient.useExistingCookie();
const sendConfirmationEmailResult = await InstaClient.sendConfirmationEmail();
console.log(sendConfirmationEmailResult)
```


## License

Expand Down
15 changes: 13 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,19 +223,30 @@ class Instagram{
}

async updateProfile({
biography = ''
biography = '',
email = ''
}){
try{
const oldData = await this.getProfileData();
this.headers.referer = `${this.baseUrl}accounts/edit/`;
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`;
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`;
const result = await this.requestNodeFetch.post(`${this.baseUrl}accounts/edit/`, payload, this.headers);
return await result.json();
}catch(e){
throw new Error(e)
}
}

async sendConfirmationEmail(){
try{
this.headers.referer = `${this.baseUrl}`;
const result = await this.requestNodeFetch.post(`${this.baseUrlZ4}accounts/send_confirm_email/`, '', this.headers);
return await result.json();
}catch(e){
throw new Error(e)
}
}



async registerLastAttemp(phoneNumber, username, password, firstName){
Expand Down

0 comments on commit 536daf0

Please sign in to comment.