I love the potential of these modules together, and I see that others are using modules like heartbeat and FBSS in tandem. However, I am really struggling to bring them together.

After setting up both modules, I created a message template for heartbeat, then updated the facebook submit status rule to include an action for updating heartbeat activity. Before I changed the variables, it did show something in heartbeat stream once (although it just displayed the message "!username has updated !title"). After updating my message template to use the variables defined in the rule, nothing gets logged and the one message that did get logged is just empty.

My message template looks like:

!username : !status (with everything else at the default settings)

And my rule looks like this:

array (
  'rules' => 
  array (
    'facebook_status_rules_update' => 
    array (
      '#type' => 'rule',
      '#set' => 'event_facebook_status_update',
      '#label' => 'Submit Facebook-style Status',
      '#active' => 1,
      '#weight' => '0',
      '#categories' => 
      array (
        0 => 'facebook_status',
      ),
      '#status' => 'altered',
      '#conditions' => 
      array (
      ),
      '#actions' => 
      array (
        0 => 
        array (
          '#type' => 'action',
          '#settings' => 
          array (
            'severity' => '6',
            'type' => 'rules',
            'message' => '<?php echo check_plain($account->name); ?> submitted the status <?php echo $new_status; ?>.',
            'link' => '/user/<?php echo $account->uid; ?>',
            '#eval input' => 
            array (
              'rules_input_evaluator_php' => 
              array (
                'message' => 
                array (
                  0 => 'account',
                  1 => 'new_status',
                ),
                'link' => 
                array (
                  0 => 'account',
                ),
              ),
            ),
          ),
          '#name' => 'rules_action_watchdog',
          '#info' => 
          array (
            'label' => 'Log to watchdog',
            'module' => 'System',
            'eval input' => 
            array (
              0 => 'type',
              1 => 'message',
              2 => 'link',
            ),
          ),
          '#weight' => 0,
        ),
        1 => 
        array (
          '#weight' => 0,
          '#info' => 
          array (
            'label' => 'Logs default activity',
            'eval input' => 
            array (
              0 => 'uid_param',
              1 => 'uid_target_param',
              2 => 'nid_param',
              3 => 'nid_target_param',
              4 => 'message_id_param',
              5 => 'variables_param',
            ),
            'module' => 'heartbeat',
          ),
          '#name' => 'heartbeat_rules_default_action',
          '#settings' => 
          array (
            'uid_param' => '[poster:uid]',
            'uid_target_param' => '[owner:uid]',
            'nid_param' => '',
            'nid_target_param' => '',
            'message_id_param' => 'facebook_status',
            'variables_param' => '@username=|=[author:user-name-url]-|-@status=|=[status:status-formatted]-|-',
            '#eval input' => 
            array (
              'token_rules_input_evaluator' => 
              array (
                'uid_param' => 
                array (
                  0 => 'poster',
                ),
                'uid_target_param' => 
                array (
                  0 => 'owner',
                ),
                'variables_param' => 
                array (
                  0 => 'status',
                ),
              ),
            ),
          ),
          '#type' => 'action',
        ),
      ),
      '#version' => 6003,
    ),
  ),
)

Not really sure where to go with this now :(

Comments

Sansui’s picture

Hrm... ok I think this might be a bug with user 0, becuase I logged in with another user and was able to have a status updated in the heartbeat stream.

I did end up using this as my reference to create my rule and message as well: http://heartbeat.menhireffect.be/docs/adding-facebook-status-logs-and-di...

Stalski’s picture

Status: Active » Postponed (maintainer needs more info)

First, is this correct?
@username=|=[author:user-name-url]-|-@status=|=[status:status-formatted]-|-
Or am i so mistaken, i don't think [author:user-name-url] is available for facebook_statusses. I think it is "owner" or "poster", not sure about that.
For the rest, i cannot reproduce it, as it works just fine here. I am also not sure if this can be done anonymous. I did not test that feature specific. Can you provide me more info or best the steps i take to reproduce it?

thx
Stalski

Sansui’s picture

Yes, I did end up changing it to poster/owner per your documentation example.

Also, I meant to say user 1, not user 0! I was using the super admin account in testing, and that was the account that wasn't displaying in the heartbeat stream (or actually, it would put a single messed up entry in the stream, and then anything else posted wouldn't display)

Stalski’s picture

Does it all work or do you have difficulties now? If not, you can close the ticket.

terbs’s picture

I don't know if this is related, but when I try to use rules to log a FBSS to heartbeat I have a lot of trouble similar to what you're describing. It can be unpredictable, usually it comes down to the variables not being properly parsed out by rules, especially if your template contains any html. I also get all kinds of problems with line breaks and wysiwygs screwing with the rules text input box.

If you're trying to get FBSS to log to heartbeat, in my experience, it's much cleaner and easier to do it with a module. You can make your own module and hook into a status submission/write it to heartbeat using something like this:

  function mymodule_facebook_status_save($status, $edit = FALSE){

		$variables = array(
			'@message' => $status->status
		);
		heartbeat_api_log("my_message_template", $status->pid, $status->uid, 0, 0, $variables);
		
	}

Peace & Love!

Stalski’s picture

Status: Postponed (maintainer needs more info) » Fixed

I would not recommend wysiwyg for the rules input. I never tested it that way and it does not seem a very good approach to have wysiwyg editors there. We need a key=value pair per single line.

@aiquandol: The code approach is very recommendable, but developers have different tools then webmasters/implementors.

For that user1 bug, if the problem still occurs, create a separate ticket for that please.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

quality4life’s picture

Hello people,
I have a problem with the use of the Heartbeat module with the FBSS modules.

Although I have the correct codes:
http://heartbeat.menhireffect.be/docs/adding-facebook-status-logs-and-di...

But I have absolutely no idea where I need to copy this code.

I would be very happy if you can help me!
Please write it as easy as possible and in plain english.
A guide for stupid people :-)

Thanks!

PS: Sorry for my bad English!

Liliplanet’s picture

Status: Closed (fixed) » Active

subscribe thx .. also wish to know where to add the code at http://heartbeat.menhireffect.be/docs/adding-facebook-status-logs-and-di...

Do we create a separate module, where do we add the above?

sorry a little lost here on how to add new tokens to be available to rules :)

Stalski’s picture

Status: Active » Closed (fixed)

The code can be imported through UI (heartbeat templates AND Rules UI) or you can put them in a custom module. I would recommend a separate module, but import the exports would be just fine (remember this is a example that might not work on your installation since it depends on content types and so)

Liliplanet’s picture

Version: 6.x-4.10 » 7.x-1.x-dev
Component: Documentation » Code
Status: Closed (fixed) » Active

Hi! Having updated to D7 finding that I cannot import the facebook status code available on menhireffect.be as the fb status module has changed name to 'statuses'.

Would most appreciate updated code or perhaps a little module to make status available in heartbeat please :)

rogical’s picture

Title: Setting up new rules for heartbeat logging - for instance Facebook Style Statuses » Integration with Statuses (Social Microblog)
Category: support » feature

Be more clear, it's Statuses (Social Microblog) now.

Liliplanet’s picture

Hi!

Please Stalski would you be so kind to update the rule for statuses at http://heartbeat.menhireffect.be/docs/adding-facebook-status-logs-and-di...

Would love the ability to include statuses in heartbeat activity :)

Stalski’s picture

Status: Active » Postponed

This is currently not possible as several bugs are still in statuses module, where the most important will be the token still being defined as drupal6 implementations. I guess still some work there, or did I check out the wrong repository ... hmm

cwithout’s picture

According to statuses issue #1531976: Token integration is broken, tokens are now working in the module. So a fix might be possible if that issue's solution doesn't completely solve this.

But for anyone who wants to have heartbeat integrated with statuses and can't get it to work, you can try the custom module solution here: http://cristinahanes.com/content/integrate-statuses-heartbeat-drupal-7

DrupalDesigner-1’s picture

I have tried both 7.x-1.0-beta1 and the dev release of Statuses and am still having problems with getting Statuses tokens to work when setting Rules Actions for Heartbeat. I posted about this in the Statuses Token integration is broken queue.

Basically the main issue I'm having is when using the tokens [statuses:sender:uid] and [statuses:recipient-id] respectively. Instead of getting the desired sender and recipient usernames, the result is the string "name" (not sure where this is coming from as I have 3 users, none of which are called "name") and the linked title of the node where the Statuses block is. Also many other Statuses tokens available in PathAuto (eg. [statuses:sender:name], [statuses:sender:link]) are not available when creating a Rules Action for Heartbeat. I have tried applying the patches at the post above but this did not fix anything.

Were there any changes on this implemented in the latest version of Heartbeat?

IceCreamYou’s picture

Tokens work with normal rules in the most recent beta of Statuses. I'm not sure what the problem would be with Heartbeat specifically.

fraweg’s picture

Hello,

does anyone get this work?

Best regards
Frank

Edit:

This link seems to be dead:

http://cristinahanes.com/content/integrate-statuses-heartbeat-drupal-7

Hase anyone copy this Instruktion? I really hope that!

cwithout’s picture

@fraweg - My site is back. I was transitioning to a new host and waited until the last minute. So DNS didn't fully propagate before the old one was shut off. The site doesn't get much traffic yet, so I wasn't expecting visitors. :)

The method I described there will still work. But the process can be a little easier using Rules now that the token integration is fixed. I was able to test that out last week. I'll post instructions using Rules as soon as I'm able.

fraweg’s picture

Hello,

this are really good news. Thanks a lot for your support!

Best regards
Frank

DrupalDesigner-1’s picture

@cristinawithout, would also appreciate this. Please provide a link when you have this

fraweg’s picture

Hello,

maybe this helps :-)

http://drupal.org/node/1803910

Best regrads
Frank

cwithout’s picture

There are a few steps missing from the brief tutorial mentioned in #22. Here's a full tutorial of integrating Heartbeat and Statuses via Rules.

http://www.cristinawithout.com/content/using-rules-integrate-heartbeat-a...

The only thing holding up full integration is that the Heartbeat module relies on nodes rather than entities. So there's no way to update/remove Heartbeat activity when a status is updated or removed as you can with nodes.

There is an issue requesting entity support here: #1484970: Remove node dependency on heartbeat.