Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
This library provides developers with a simplified way to authenticate, search contact, add contact, update contact, and delete contact in Dynamics Customer Insights - Journeys
Dynamics Customer Insights - Journeys - Dataverse
This library provides a set of functions to interact with Microsoft Dataverse (formerly known as Common Data Service) using the Dynamics 365 REST API. It includes functionalities for authentication, searching contacts, adding contacts, and updating contacts.
To use this library, you need to have requests
and json
modules installed. You can install requests
using pip:
pip install requests
Now you need to install the Dynamics library:
pip install dynamicscontacts
Import the library
from dynamics import contacts
This function authenticates and returns an access token required for accessing Dataverse.
# Replace these variables with your actual values
tenant_id = 'tenant_id'
client_id = 'client_id'
client_secret = 'client_secret'
tenant_name = 'tenant_name'
crm_url = f"https://{tenant_name}.crm4.dynamics.com/"
# Create Access Token
access_token = contacts.accessToken(tenant_id, client_id, client_secret, crm_url)
Now if the access_token is generated successfully you may proceed, otherwise make sure you setup the environment correctly. You may need to go to this reference.
This function searches for a contact in Dataverse based on the provided search criteria.
# Search for a contact
search_params = {
"firstname": "fname",
"lastname": "lname",
"emailaddress1": "email"
}
# You may customize the returned fields here
return_fields = "firstname,lastname,emailaddress1,mobilephone"
crm_contacts = contacts.search_contacts(crm_url, access_token, search_params, return_fields)
print(contacts)
This function adds a new contact to Dataverse.
contact_data = {
"firstname": "fname",
"lastname": "lname",
"birthdate": "%Y-%m-%d",
"emailaddress1": "email",
"mobilephone": "12345678"
}
# Add contact to Dataverse
add_crm_contact = contacts.add_contact(contact_data, crm_url, access_token)
If you want to know the fields that you can add to Dynamics, please check this reference.
This function updates an existing contact in Dataverse based on the provided contact ID and update data.
# Update contracts
update_data = {
"firstname": "fname",
"lastname": "lname"
}
contact_id= "contactid"
updated_crm_contact = contacts.update_contact(access_token, contact_id, update_data, crm_url)
This function Deletes an existing contact in Dataverse based on the provided contact ID. You need to make sure that you have the proper permissions and that there are not dependent records connected to this contact.
contact_id = '' # Replace with the actual contact ID
deleted = contacts.delete_contact(crm_url, access_token, contact_id)
if deleted:
print("Contact deleted successfully")
else:
print("Error deleting contact")
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the Apache License. See the LICENSE file for details.
I'd like to express my gratitude to the enchanting city of Tartu, Estonia, where I spent a delightful vacation and crafted this code.
FAQs
This library provides developers with a simplified way to authenticate, search contact, add contact, update contact, and delete contact in Dynamics Customer Insights - Journeys
We found that dynamicscontacts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.