How can one use the Message module in D7?

I can only define Message types, and nowhere I can find how to configure arguments and generate rules for it.

Would be nice to have some type of documentation about this.

Comments

JohnnyX’s picture

Doesn't work?
Created a message type but not there after added...

Reloaded twice to see the message type and click on "manage fields" give me a page not found error message.

chrisroditis’s picture

You can use rules module or write your own module to define when a message of the type you created should be logged. See the message_example.module for a guideline on how to do that.

Regarding the page not found, I don't know, sorry, latest dev works fine for me.

JohnnyX’s picture

Ok, I'll try the latest dev. Thanks!

Do message create a "activity stream" like Facebook or Heartbeat module? Or only a site users have to refresh manually?

chrisroditis’s picture

Yes it does. AFAIK message integrates very well with Views so you can create a view that displays messages and manipulate it with js to make it refresh every X seconds. I guess there must be a module out there to do just that.

JohnnyX’s picture

A views solution would be great but there is no D7 module available at the moment

http://drupal.org/project/views_simplespy (no port started! Would be the best solution!)
http://drupal.org/project/views_hacks (autorefresh not ported yet, could be a workaround in the near future...)

chrisroditis’s picture

The best approach however is integration with node.js, through this module http://www.drupal.org/project/nodejs.

JohnnyX’s picture

Nodejs needs a installed server process, right? views_simplespy simply works with javascript.
I looked at nodejs and heartbeat but haven't found much documentation about nodejs D7 module (install, configure)...

chrisroditis’s picture

Yes I am too waiting for it to mature some more, however it solves the problem created by the approach views_simplespy takes, which is frequently polling a server for changes - if any, which can easily kill servers under increased traffic. A node.js server doesn't have trouble handling many connections of this kind, since it sends an update only when there is something new of interest.

Haven't worked on it yet though to have a rough idea of the difficulties involved in integrating message and the node.js module, but I have it in my plans for a project I'm working on currently.

JohnnyX’s picture

nodejs could be a good solution if a good documentation (install and configure) will be available. Javascript/ ajax is simple a easy and fast solution which works fine...

NonProfit’s picture

I can concur with #1, "click on "manage fields" give me a page not found error message."

I've written a View and a Rule which, seem to me, should work but am not able to generate any messages. D7 documentation would be very much appreciated.

mansspams’s picture

Does anyone knows how to set up rule to create messages? Does it currently work at all?

Readme says "create message instances via the "Entity create" action, whereas the text replacement arguments can be set via the "Set data value" action". Should I add save action too?

Update: Ok, I think I got the Rules part... had to drill deeper. What I did was create new rule with some trigger, set actions "Create a new entity" of type Message, "Set a data value" of entity-created:arguments:MY_ARGUMENT_HERE, "Save entity". That should be enough? Will if work without reference fields in message type?

Jax’s picture

The project page should mention which versions of entity, rules, ctools and message work together. At this moment I have the latest version of all and I get the errors:

Error message

    Warning: Illegal offset type in isset or empty in EntityDrupalWrapper->spotBundleInfo() (line 676 of /home/ojacquet/public_html/brain/sites/all/modules/contrib/entity/includes/entity.wrapper.inc).
    Warning: Illegal offset type in isset or empty in field_info_instances() (line 684 of /home/ojacquet/public_html/brain/modules/field/field.info.inc).
    Recoverable fatal error: Object of class MessageType could not be converted to string in drupal_write_record() (line 6831 of /home/ojacquet/public_html/brain/includes/common.inc).

mansspams’s picture

Are you using message example module? It is badly broken, you need to manually add entityreference field field_node_ref and hide it in display configuration.

amitaibu’s picture

> It is badly broken, you need to manually add entityreference field field_node_ref and hide it in display configuration.

It's actually (supposed to be) fixed in the -dev version

mansspams’s picture

Quite possible, Amitaibu. It is possible that I have enabled, disabled and overwritten this example feature so many times while trying to get it to work, that I have lost track of what is broken and what is not :) But bottom line is that it works and creating Message from code is possible.

@Jax These errors seems like ones I saw while hacking creation of Messages with Rules. I was not able to find root of problem, but you may want to follow #1306532: Intergarion with Rules test fails to see how it turns out.

Pierre.Vriens’s picture

Issue summary: View changes

Just in case anybody is still struggling with this issue (to get started with the great Message module), have a look at my answer I wrote to the question "How to implement a follow author (or user) function?" (if you want, just skip the "Basic solution" in it and start from "Improved solution").

That answer includes a Rule (in rules export format) and a Message type (also in export format). The rule will create a Message if some user gets "flagged" with a flag named "follow" (so make sure to first define such fllag with same machine name before you try to import the Rules example there, to avoid the Rules import would fail).

The rule and Message type also take advantage (use) the so called "Replacement tokens" technique, which IMO is a great (but not obvious to understand) feature of the Message module. For way more details on such tokens, have a look at "What's the purpose of "Replacement tokens" of a Message type?".

Pierre.Vriens’s picture

Title: Message D7, how to use » How to use the Message module and use it with Rules?
bluegeek9’s picture

Status: Active » Closed (outdated)