[GSoC 2016: Social API] Week 10: A Social Post implementer

Submitted by gvso on Wed, 08/03/2016 - 01:42

Week 10 is over, and we are only two weeks away from Google Summer of Code final evaluation. During these ten weeks, we have been rebuilding social networking ecosystem in Drupal. Thus, we created the Social API project and divided it into three components: Social Auth, Social Post and Social Widgets.

In order to test the abstraction of these projects, we also created implementers during these weeks. As a result, there are integrations for Social Auth (social_auth_facebook and social_auth_google) and Social Widgets (facebook_widgets and facebook_widgets_buttons). Nonetheless, we had not worked on a Social Auth implementer yet; therefore, I started developing one two weeks ago. This implementer module is called Social Post Twitter

Achievements

In the last two weeks, I worked on the settings form and Twitter user entity, as well as on the authentication and storage layers. To complete an early version of the implementer, the module should be able to tweet on a user's behalf. Thus, I developed this functionality during this week.

This behavior is achieved by using the Rules module, which allows site builders to determine which conditions should trigger the Tweet action. This action allows to set the status message that will be tweeted. It also offers support for tokens but only for nodes and users so far. This token replacement is a built-in functionality of Social Post Twitter; the native token integration is not yet completely supported by rules.

Tweet Reaction Rule

This is how the process looks like. Make sure to authorize an app to post on behalf your user if you want to follow these steps.

First, we need to create a new reaction rule.

Reaction Rule form
Reaction creation form

After creating a reaction rule, we must add the Tweet action

Adding Tweet action
Adding Tweet Action

Then, we can set the status text for the tweets

Status text
Adding status text value

Testing

Now that a Twitter project was associated with the Drupal Site, the user has authorized the project to tweet on his behalf, and the Reaction Rule was created, the Rule can be tested. In our example, after creating a new content, the Drupal site tweeted the following:

Tweet created by Social Post Twitter

Next week

The Social API project and its main components have at least an implementer each. As Google Summer of Code final evaluation is close, I would like to create a handbook which can be used by other developers to create new implementers. Furthermore, some of the modules I worked on during these ten weeks don't still have a comprehensible documentation. Hence, I would like to document all the Social Initiative projects during the remaining weeks of GSoC.

As always, feel free to contact me if you have any question. You can also collaborate with the Social Initiative projects (social_apisocial_authsocial_post, and social_widgets). We also have our weekly meetings, so follow the Social Initiative and join us on Wednesdays.

Stay tuned for the next weekly summary!