Skip to content
Anuja Ware edited this page Oct 9, 2016 · 3 revisions

Welcome to the Chat Bot wiki!

This engine contains following models which you can use to create a conversation metadata:

  1. Category:

    • Defines a category of a conversation.
    • It has many sub categories.
  2. Sub Category:

    • Defines sub category of a conversation
    • It has following attributes:
    • name - Mandatory
    • description - Optional
    • repeat_limit -
      • default - 0 i.e. no limit otherwise a positive integer
      • It defines a number about how many times conversation can be repeat to the user
    • approval_require -
      • It's a boolean flag which defines whether conversation should automatically deliver to the user or skip it till get approved (say by admin)
    • priority -
      • Used to assign priority of conversation
      • Positive integer - greater than 0, less than 11
    • starts_on_key and starts_on_val -
      • Both the fields are used in the combination to specify the scheduling for the conversation
      • Valid values in combination are:
        1. 'after_dialog', [DialogCode]-> Schedule once user receive a particular dialog (Will come back to this later)
        2. 'after_days', [N] -> Schedule after N number of days
        3. 'immediate', nil -> Schedule immediately * is_ready_to_schedule -
      • Boolean flag as named - Schedule only if its ready to schedule
      • Usage of this flag could be -> Mark it as true once edits are done for whole conversation * initial_dialog -
      • Association with a dialog model which specifies from which dialog conversation starts * dialogs -
      • Has many dialogs which come under current sub category i.e. all the dialogs of a conversation
  3. Dialog:

    • It's a dialog of a conversation
    • It contains fields:
      • code - Uniq identifier for a dialog
      • message - The dialog text
      • message_type (flag): txt(Text)/link(Link)/utube(Youtube)/vimeo(Vimeo)/img(Image) (TODO: Read details here.)
      • user_input_type (flag): ch(Choice)/cnt(Botcontinue)/slt(Single line text)/mlt(Multiline text)/ddw(Dropdown)/date(Date)/attach(Attach) (TODO:Read details here.)
      • Has many options
  4. Option:

    • Child of a dialog i.e. option belongs to dialog
    • Has fields:
      • name - Option text
      • interval -
        • Specify the interval when to schedule conversation if user selects this option
        • It has a format 'DAY:N', where N - positive integer
      • deprecated - Boolean flag. If true this option won''t be shown to the user
      • decision - Next dialog
  5. Conversation:

    • This model save the current status of a conversation
    • It has polymorphic association which can associate with any model in your application
    • Attributes are:
      • aasm_state - scheduled/released/started/finished
      • viewed_count - No. of times conversation has been delivered to the user
      • scheduled_at - Scheduled date
      • priority - Its a priority. Initialize by default priority given in metadata i.e. in sub category
      • sub_category - belongs to sub category
      • dialog - Current dialog
      • created_for - Polymorphic relation to associate with other model
      • option - Current selected option by the user in the conversation
    • Methods:
      • Class methods:
        1. "schedule" - Accepts an object for which conversations has to be scheduled. And schedule conversation according to the metadata. (TODO:Read details here.)
        2. "fetch" -
        • It accepts:
          1. an object to whom conversation has to be delivered
          2. option_id (optional) -
            • If present method returns next dialog comes after this option and saves current state of a conversation
            • If not present it check for next conversation for the object and return appropiate data i.e. dialog and its options
Clone this wiki locally