This Repo is work in progress. Future plan is to integrate data from other social media and emails.
This is inspired from the this repo.
Contribution needed for:
- Other APIs to be converted to Python structure
- Social Media Integrations
- Initating the conversations API
from monica.contacts import Contacts
import pandas as pd
contacts = Contacts(access_token)
- Lists a few contacts from the database with criteria
limit=10 # default
page=1 # default
sort="updated_at" # default
json_data = contacts.list_contacts(self, limit=limit, page=page, sort=sort) # returns json data
pd.DataFrame(json_data['data'])
- List all contacts (Save it as csv file for other features)
sort = "updated_at" # default
json_data = conversations.list_all_your_contacts(sort=sort)
df = pd.DataFrame(json_data['data'])
df.to_csv('contacts_from_monicahq.csv')
- Initating the conversations API
from monica.conversations import Conversations
import pandas as pd
conversations = Conversations(access_token)
- Lists a few conversations from the database - Official API does not return all the conversations
conversations.list_conversations()
- Create conversation object
conversation_id = conversations.create_conversation_object(happened_at, contact_field_type_id, contact_id)
- Add message to a conversation object
conversations.add_message(written_at, written_by_me, content, contact_id, conversation_id)
- Lists all conversations of a contact
json_response = conversations.list_conversations_of_a_contact(contact_id) # returns the whole json response from API.
pd.DataFrame(json_response['data']) # to see it properly in a dataframe format
- Delete conversation
conversations.delete_conversation(conversation_id)
- Delete all conversations of a contact
conversations.delete_all_conversations_of_a_contact(contact_id)
- Add multiple messages to contact
conversations.add_multiple_messages(contact_id, conversation_id, df)
# df is pandas dataframe in a specific structure expected, will add later
- Initating the conversations API
from monica.contact_field_types import Contact_Field_Types
import pandas as pd
contact_field_types = Contact_Field_Types(access_token)
- Lists all field types on your monica
json_data = contact_field_types.list_all()
df = pd.DataFrame[json_data['data']]
df.head()
- Retreive ID of field type
field_type_id = contact_field_types.get_contact_field_type_id(object_name)
Check out how to upload gmail data here
Check out how to upload linkedin data here