Rational
Marketing Automation could be a good addition to Tryton as it has all the data of the company and especially those linked to customers. This blueprint propose to add the functionality to automate the communication.
Proposal
The feature is mainly a workflow engine based on selected records. The workflow activity starts an action for a record and the result of this action move the record to the next activity.
The action is by default about to send an email to the party linked to the record (it may later be extended to support other actions like phone call etc.). The result of sending an email can be “email opened”, “email action clicked”, “reply” or “bounce”. Each result can be triggered for its opposite after a delay.
Marketing Scenario
Scenario
- Name
- Model (having a specific Mixin)
- Domain (to select record to run)
- State: Draft/Running/Stopped
Activity
- Name
- Scenario
- Parent
- Condition: result of the parent action (email opened, action clicked etc.)
- Delay, Hour & Day: start the activity after the condition of the parent is valid.
- Domain: limit to record validating this domain
- Action: send email,…
The activities without parent does not have a condition (or the condition is always valid).
Record
- Scenario
- Record
- Blocked
There is a unique constraint on Scenario and Record
Record Activity
- Activity
- Record
- Parent
- State: Waiting, Done, Cancel
- Date
A cron task search regularly for new Record to create for each scenario.
When a new record is created, the scheduled record activities are created for the first level of activities that validate the domain.
Another cron task search regularly for waiting record activities with a date in the past to process them. When an activity is processed, it cancels the negative activity sibling and it creates new children record activities.
To track the opening of the e-mail, a transparent image will be added to the HTML content (this is not an accurate method as many MUA block such image but it is the only available). The link will point to a hook that will trigger the right record activity. To track the action of an e-mail, the href
attribute of the tags <a/>
will be replaced by specific URL that will trigger the record activity and redirect to the original URL.
In the template rendering context, an URL will be available that will block the record. When the record is blocked, no more processing will be performed for it. And of course the context will also contain the record.