By Mike Feng on Tuesday, 01 September 2015
Replies 5
Likes 0
Views 1.1K
Votes 0
Hi

For the longest time, I've been adding notifications into EasySocial by manually inserting a record into #__social_notifications, because I can never get the instructions on the documentation to work. Now I am about to release a new extension and I would like to make full use of the EasySocial API, but I still can't seem to get it to work.

Can somebody explain the docs in detail? I have the .alert rule file in the right folder, but I'm not sure if I've named it right (I just named it <component-name>.alert). For the record, I've scanned it in the EasySocial backend and it was detected with no problem. However, based on the names of the other rule files used by EasySocial itself, it would seem that the naming of the rule file matters, but nowhere on the docs did it mention what or how.

Here's a list of issues not covered by the docs, or covered but very vaguely:
1) How does the rule file work and how exactly does EasySocial interact with it? How should it be named?

2) For each rule, what does "element" and "rule" mean, and how does EasySocial interact with it later?

3) In the logging doc (http://stackideas.com/docs/easysocial/developers/notifications/logging) it says "$cmd - (Required) This should be the same command that is defined in the rule file". No where on the Rule File doc did it mention anything about "command".

4) For the $options array, please explain what 'context_ids' and 'context_type' are, and how EasySocial interact with these settings.

5) I am assuming, based on some parts of the doc, that the tags {actor} and {target} are supported. Are there other tags that are supported? I ask this because sometimes, a notification may contain multiple links to other specific content. Do we manually insert the hyperlink into the 'title', or do we use tags?

6) If you can elaborate on the $emailOptions as well, that would be most useful!

Thanks in advanced!
Hey Mike,

Firstly, the rule file can be named anything as long as the file name ends with .alert . If you look at the sample alert file attached below, it will give you a better idea of how you can create a custom alert.

The command is a combination of [element][rule] . So for instance, the command for one of the rules in the attached file is likes.item or likes.involved

By the way, the notifications currently only supports {target} and {actor}.
·
Tuesday, 01 September 2015 23:23
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi
Thanks for the reply. Can we make it such that notifications will work without the rule file? Like how it does if we insert the record into #__social_notifications manually. The problem with the rule file is that it doesn't detect automatically. The user needs an additional step to go to EasySocial's backend and scan for it after installing our extensions. I'm still not sure how EasySocial interacts with the rule file.

On that note, is there a way to make EasySocial scan for rule files via code? So we can add it into the component's script.php file.
·
Wednesday, 02 September 2015 09:37
·
0 Likes
·
0 Votes
·
0 Comments
·
Another question: do we have to re-scan the rule file everytime we change its content?
·
Wednesday, 02 September 2015 10:52
·
0 Likes
·
0 Votes
·
0 Comments
·
One more question that I mentioned previously:

4) For the $options array, please explain what 'context_ids' and 'context_type' are, and how EasySocial interact with these settings.
·
Wednesday, 02 September 2015 18:34
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Mike,

I am really sorry for the delay of this reply as I was a little occupied with the development of EasySocial 1.4 beta earlier. Hm, if you are able to insert these records in the table, that would be possible to. It's entirely up to you how you really want to do this

Context Ids and Context Types are optional as sometimes we could be dealing with a different item instead of the action. For instance, a new notification for user uploading photos in the group, "group a" has the uid of the group. However, we need to reference this with the real action that is performed which is the photo id and it comes handy when we want to alter the output of the notifications
·
Saturday, 05 September 2015 17:30
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post