You’ll want to look for something like “tumblr share api”. That took me to this page which describes how to set the title and body of your Tumblr post by setting
data-content on your button, respectively.
Facebook is quite a bit different. A similar search takes me to this page. The prevailing paradigm in Facebook is to share an entire page rather than just some text, so instead of changing the button’s properties to send your quote, you’ll want to configure your site to look good when shared. When you share a page on Facebook, their server sends a request to your page and then looks at some values in your header. Here’s the example from the page I linked to:
<title>Your Website Title</title>
<!-- You can use Open Graph tags to customize link previews.
Learn more: https://developers.facebook.com/docs/sharing/webmasters -->
<meta property="og:url" content="https://www.your-domain.com/your-page.html" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Your Website Title" />
<meta property="og:description" content="Your description" />
<meta property="og:image" content="https://www.your-domain.com/path/image.jpg" />
Configuring these values will determine what the Facebook share looks like. Creating a post on the user’s behalf would require using OAuth, and I’d advise you wait until you’re doing backend programming to even think about that. You can hack your way to success by manipulating the above