Browse Source

add auto reply function

Ray Lee 6 years ago
parent
commit
97e143a85b
1 changed files with 103 additions and 0 deletions
  1. 103 0
      auto_reply_bot.md

+ 103 - 0
auto_reply_bot.md

@@ -0,0 +1,103 @@
+#fb chatbot auto reply function
+## Feature
+### Admin Can...
+
+* List pages under his management
+* List recently posts for certain page
+* Setup some post reply rules/templates for certain post
+  * rules can be either wildcard or keywords 
+* Setup some private message reply rules/content for certain page
+  * rules can be either wildcard or keywords
+* CRUD all post reply rules
+* CRUD all post reply templates
+* CRUD all private message reply rules/content
+
+
+### System will...
+
+* Auto reply post under certain post
+* Auto reply private message for certain page
+* Save all post content
+* Save all post replies
+* Save all private message
+
+
+##Model 
+### Admin
+```
+has_many :page_ownerships
+has_many :pages, through: :page_managerships
+```
+
+### PageManagership
+```
+belongs_to :admin
+belongs_to :page
+```
+
+* admin_id
+* page_id
+
+### Page
+```
+has_many :page_ownerships
+has_many :admins, through: : page_managerships
+has_many :posts
+has_many :pm_reply_rules, class: MessageReplyRule
+
+.auto_reply_post(user_input)
+.auto_reply_pm(user_input)
+```
+
+* facebook_id
+* name
+
+### Post
+```
+belongs_to :page
+has_many: :reply_rules, class: PostReplyRule
+```
+
+* page_id
+* facebook_id
+
+### PostReplyRule
+```
+belongs_to :post
+```
+
+* post_id
+* reply_type, [wildcard, keywords]
+* keywords
+* reply\_template\_id
+* enable
+
+### PostReplyTemplate
+```
+belongs_to :page
+```
+
+* page_id
+* content, text
+
+### PrivateMessage
+```
+belongs_to :page
+```
+
+* page_id
+* sender\_facebook\_id
+* receipt\_facebook\_id
+* message\_reply\_rule\_id
+
+### MessageReplyRule
+```
+belongs_to :page
+```
+
+* page_id
+* reply_type, [wildcard, keywords]
+* keywords
+* reply_content
+* enable
+