Once upon a time, tweeting already published content from a Drupal site was a simple task that required no extra effort. The main deal was to install the Social Post Twitter module, and everything worked.
To date, this module, unfortunately, does not work appropriately on Drupal 9. But this does not mean that you need to stop integrating your site with Twitter. It is one of the main communication channels between businesses and potential customers. Integrating social media with your website increases your brand awareness, attracts users to interact, and so has a positive effect on SEO. In a word, there are a lot of pluses.
In this blog post, our Drupal 9 development team shows you how to create a Twitter integration and share tweets after the content has already been published on the Drupal 9 site. We invite you on this exciting journey.
Step-by-step guide on how to tweet from a Drupal site 9
Today, Golems will demonstrate how to set up programmatically tweets from a Drupal site if the Drupal Twitter module is not working or work improperly.
Step #1. Getting Know How the Social Post Twitter Module Works
To create something similar to the Social Post Twitter module, you need to understand the logic of its work. This module is based on the abraham/twitteroauth package.
Step #2. Get Authentication Data
Our journey begins with getting access tokens. Without this, you won't enable automatic tweeting from your Drupal site when the content is already published. Therefore, next, we go to the Developer Twitter Platform page. We should do this to apply for developer access.