-
-
Save Znack/3a10e4207a9bfbaca7f9 to your computer and use it in GitHub Desktop.
Import contacts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function importContact (phone, firstName, lastName) { | |
return MtpApiManager.invokeApi('contacts.importContacts', { | |
contacts: [{ | |
_: 'inputPhoneContact', | |
client_id: '1', | |
phone: phone, | |
first_name: firstName, | |
last_name: lastName, | |
}], | |
replace: false, | |
}).then(function (importedContactsResult) { | |
saveApiUsers(importedContactsResult.users); | |
var foundUserID = false; | |
angular.forEach(importedContactsResult.imported, function (importedContact) { | |
onContactUpdated(foundUserID = importedContact.user_id, true); | |
}); | |
return foundUserID || false; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment