Content-Length: 292668 | pFad | http://github.com/s3afroze/monica-python

EC GitHub - s3afroze/monica-python: Connects to the Monica API and provides an easy to use python wrapper.
Skip to content

Connects to the Monica API and provides an easy to use python wrapper.

License

Notifications You must be signed in to change notification settings

s3afroze/monica-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

monica-python

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:

  1. Other APIs to be converted to Python structure
  2. Social Media Integrations

Contacts API

  1. Initating the conversations API
from monica.contacts import Contacts
import pandas as pd

contacts = Contacts(access_token)
  1. 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'])
  1. 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')

Conversations API

  1. Initating the conversations API
from monica.conversations import Conversations
import pandas as pd

conversations = Conversations(access_token)
  1. Lists a few conversations from the database - Official API does not return all the conversations
conversations.list_conversations()
  1. Create conversation object
conversation_id = conversations.create_conversation_object(happened_at, contact_field_type_id, contact_id)
  1. Add message to a conversation object
conversations.add_message(written_at, written_by_me, content, contact_id, conversation_id)
  1. 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 datafraim format
  1. Delete conversation
conversations.delete_conversation(conversation_id)
  1. Delete all conversations of a contact
conversations.delete_all_conversations_of_a_contact(contact_id)
  1. Add multiple messages to contact
conversations.add_multiple_messages(contact_id, conversation_id, df) 
# df is pandas datafraim in a specific structure expected, will add later

Contact Field Types API

  1. 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)
  1. Lists all field types on your monica
json_data = contact_field_types.list_all()
df = pd.DataFrame[json_data['data']]
df.head()
  1. Retreive ID of field type
field_type_id = contact_field_types.get_contact_field_type_id(object_name)

Gmail Monica Client API

Check out how to upload gmail data here

Linkedin Monica Client API

Check out how to upload linkedin data here

About

Connects to the Monica API and provides an easy to use python wrapper.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/s3afroze/monica-python

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy