What would we like to use it for?
- Interaction log on the contact page: needs a nice representation of different kinds of interactions and limited filter capabilities (especially on the activity type and date).
- Segmentation of contacts: needs advanced / fast filtering of activities often based on Activity Type specific fields - but usually focussing on a few Activity Types.
- Contact data change-log: needs a way to store differences between two states. This differences don't need to be searchable.
Activities
Activities are simply interactions between the organisation and a contact. Generally an activity tells us that a certain kind of interaction (Activity Type) with a contact took place at a certain time, within a specific context and with specific content. What kind of content or context depends heavily on the Activity Type. It's hard to come up with a unified data-structure that can represent all kinds of contents. Our current proposal is to limit the in-table data to two integers (may be foreign-keys) and a text field (which may also contain serialized data).
So we get a data-model close to this:
- id (INT): unique id
- date (INT)
- type (VARCHAR): foreign key for Activity Types
- supporter_id (INT): which contact was involved
- data1 (INT): number, foreign key or integer flag
- data2 (INT): number, foreign key or integer flag
- content (TEXT): text or serialized php-data for additional content that doesn't need filtering but is still useful.
Note that the meaning of data1, data2 and content is only defined per Activity Type.
Activity Types
To get a nice Activity-Type specific layout and advanced filtering we thought of a plugin system that can handle the display of an Activity and also define a views relation so we can access Activity Type specific data.
Should activities be entities?
Currently I'd like to keep things slim/fast and I don't see the benefits of making it activities. But I'd love to be convinced otherwise. ;) Yes. Activity = entity type. Activity Type = bundle.
Examples
Specific use-cases and how we would implement them. Feel free to contribute examples!
Campaign with petitons
A campaign that involves signing one of several petitions (webforms having a node_reference to a campaign-node). We want to get a list of all contacts that took action during the campaign.
We would use the fields as follows:
- type = "petition_signed"
- data1 = nid of the petition
- data2 = sid of the webform submission
For the list of contacts we'd make a view with contacts related to activities (filtered by petition_signed) joined to the petition node (filtered by the campaign nid) and group the whole thing by contact. That's it.
What do you think about this?
Comments
Entities
Ok, I already convinced myself during writing this that naturally activity is an entity type and Activity Types are its bundles.
more use cases
Great wrap up Roman!
here a few more use cases....
Ring them up - phone list
In context of a campaign (or something like a "case") the user creates a filtered list of contacts displaying their phone number. Then he/she calls each person, one by one. After each call the user logs an activity to keep record of who's been reached, who will get another call later and what the response was.
Leave a comment
A user leaves a comment on a blogpost. This comment is logged as activity (which could lead to a tag being added to the contact record).
Send an email
If you send an email to a contact (via your normal email client) you can add an email address in BCC. This way the email is picked up by Redhen, it's automatically assigned to the contact record and logged as activity. This sort of stuff is nice for lead tracking or big donor management.
Shared
Whenever a contact hits a share button after filling out a webform (share buttons are usually displayed on the thank you page) it's logged as activity. This way you can track who really shares your stuff.
Meeting
Whenever you have a meeting with a contact you may log it as activity. You may also want to add a few notes on what the meeting was about and how to further follow up on the meeting. This can be also used for sales as well as donor / constituent management.
Direct Mail
You can export contacts as csv for mass mailings. Whenever you do that you are automatically asked whether you also want to log it as activity for those contacts. This way you can keep track of mailings. Ideally the letter is attached to the activity so that it can be reviewed later.
Donation
Obviously a donation or a payment can be logged as activity. It's important to differentiate between a reoccurring payment and a one off donation / payment. This could also play well with the membership module :-)
Activities
Activities in Party are pretty similar to what you describe at the moment. We have an entity type 'activity' with bundles that are called activity types. When you create an activity type it automatically gets the following fields:
It would be good to find common ground here and work together to make a useful Activities system.
Cardinality
Hi,
thanks for your input!
The main difference between our two architectures seems to be the cardinality of the participants.
Do you have other use-cases for the multi-cardinality of the participant field?
In my draft the event would be an entity on itself and there would be a "has_taken_part_in" activity that links each participant to the event.
I'd prefer to keep a simple one-table structure if possible.
We could easily add the assignee to the table. I'd like to get some additional input before that though.
ThinkShout's thoughts on an logging system
@torotil et al - Thanks so much for your interest and time in pushing this forward! We're really excited to collaborate with More Onion on RedHen.
We have a logging system / activity tracker as part of RedHen core on our internal roadmap very similar to what you're proposing. Some highlights of what we're planning, all pending to change/discussion:
I like your idea of creating links to other arbitrary data like web form submissions. I imagine we can come up with an elegant system allowing other modules to add their own keys to the logging schema.
By the way, I keep using the term "log" or "logging" as a placeholder nomenclature. Activity and it's derivations work as well, as long as everyone's on the same page re: meaning.
@rlmumford, if at all possible, we'd love to collaborate with the Party, and perhaps CRM Core, teams on a common activity tracking system.
Lev Tsypin
ThinkShout, Inc.
thinkshout.com | twitter.com/levelos
Thanks for your input. The
Thanks for your input. The logging is definitely part of our draft.
For us the "additional data" is what makes flexible segmentation possible so it has top priority.
I've taken a look at Messages and how it uses tokens. There is one main concern about it, that needs to be cleared up: Messages being created in rules using tokens make localization practically impossible or at least a nightmare. In the past we ran into the same problems with heartbeat. Since most of our sites are multilingual that's a blocker.
For you to check out
I've created a sandbox module for my "redhen_activity" module so you can play with it.
http://drupal.org/node/1721922
activity in core
That's great @matthias_mo, we'll take a look and chime in. But just to be clear, we're already working on a redhen_activity module that's included in the core RedHen package. It will be pushed to a branch called activity within the next day or two. It's great that there are multiple fronts on this effort and different approaches that might be useful for different use cases. At the least, though, we need to be sure to avoid namespace conflicts.
BTW, regarding the need to extend activities with additional data, our activity entries will be fieldable entities, so a site builder / developer could add additional fields as needed to the activity entities and hook into their creation to set the right values.
Lev Tsypin
ThinkShout, Inc.
thinkshout.com | twitter.com/levelos
How do I actually use Activity?
Well, I installed the RedHen Activity module, eager to have a way to finally keep notes and other logs on phone calls and other interactions with our customers. I was planning (reluctantly) to just start building my own for RedHen, and I was excited that you guys rightfully put one in instead.
However, I have no idea what to do with it. I see an Activities tab on the contact detail; and I see an Activity stream page, but there's no way to create a new one, or create Activity types, or anything else I would expect.
I am really eager to start using thing -- I really need to start using this as we need to manage customer calls. Can anyone tell me what I'm missing here?
activities vs notes
@somatics, activity log entries are created automatically when actions are taken on a contact. Current actions that are logged include:
The templates for the body of a log entry can be overriden from /admin/structure/messages. It sounds like the other functionality you are looking for already exists in the notes module. Make sure that's enabled and you'll see a notes tab on contacts where you can view and create notes. When creating notes, you can optionally add a related engagement score. Notes can also have fields added to match your use case.
Good luck!
Lev Tsypin
ThinkShout, Inc.
thinkshout.com | twitter.com/levelos
Custom Connection Types
I might be out of my element but has anyone noticed that custom relationship types do not get logged to Activity? For example, I created a "Currently Employed At" relationship type and I get nothing when I update the connections. I do notice that the predefined RedHen types do work though.
Good catch @jhoffmcd. I think
Good catch @jhoffmcd. I think it's fair to consider this a bug which we can work on resolving. If you're up for it, please post an issue in the redhen queue!
Lev Tsypin
ThinkShout, Inc.
thinkshout.com | twitter.com/levelos
Ah, thanks
Thanks for the reply, and for the quickness of it! Okay, so that's what I was suspecting. You guys are using the term "Activity" in a different way than I understood it. It seems to me that being able to manually create records/notes of events such as phone calls, meetings, appointments, perhaps tasks, etc. is standard or defining feature of CRM (otherwise, it's just a phone book), and most solutions I've seen tend to call these Activities. Often notes are a different entity entirely, that don't track things like dates and locations. I assumed the same was true of RedHen Notes, especially since it didn't start with any fields like that and I didn't see any discussion of that.
"Tricking out" RedHen notes with event-related fields is exactly what I was planning to do when I said I was going to build my own, but when I heard RedHen was releasing an Activity module I stopped and waited, since I'm interested in following best practices for the growing RedHen application and not reinventing things to leave lying around and add complications, and I made the aforementioned assumption about Activities.
Okay, back to the field drawing board for Notes...