aggregate

Methods

(inner) aggregate(conversation) → {object}

Takes a conversation and extracts:

  • psid (page scoped user id) the messenger user id as per that page
  • metadata object with startTime, lastActive, bot_identifier & conversation
  • responses the responses from the conversation
Source:
Parameters:
Name Type Description
conversation object

A conversation object generated by botkit.

Returns:
Type:
object

PSID, responses & submission metadata from the conversation.

(inner) extractTimeStamps(responses) → {object}

Source:
Parameters:
Name Type Description
responses object

value of the responses key in the conversation object

Returns:
Type:
object
  • An object of question and ISO 8601 timestamps with the structure {question+'TimeStamp': {text: }}

(inner) genOnaSubmission(conversation) → {object}

Generate an Ona submission from an aggregated conversation

Source:
Parameters:
Name Type Description
conversation object

an aggregated conversation

Returns:
Type:
object

a valid Ona submission object

(inner) removeIntros(responses) → {object}

Remove key and value pairs with intro* in the key

Source:
Parameters:
Name Type Description
responses object

value of the responses key in the conversation object

Returns:
Type:
object
  • responses without intro questions