auto_reply_bot.md 1.6 KB

#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