Example default rules

SocialHub entities come with default example rules that you can build your own rules upon.

Note that you need to enable Rules UI and SocialHub reference to make use of these rules.

Example rule: Publish node content to SocialHub

This is a simple Rule that reacts when content is published, creates a SocialHub Post and references the node to it. Some of the content's fields are selected as post payload and the Post is saved "published, to be send". The creation of this post will trigger an outgoing API requests to the SocialHub.

Events:

  • Before saving content: In this case we want to check whether the content is saved published, no matter whether it is new or not.

Conditions

  • Content is of type Article
  • Content ([node]) is published
  • Content ([node-unchanged]) is NOT published

Actions

  • Create a new SocialHub post entity
  • Set a data value: [post:status] = Published, waiting to be send
  • Set a data value: [post:socialhub-reference-node] = [node]
  • Set a data value: [post:reference-fields:0] = body
  • Set a data value: [post:reference-fields:1] = field_image
  • Save entity (SocialHub post)