Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Slack Chat Bot is designed with a sequence of three dependent actions (like microservices) which is invoked by an internal OpenWhisk alarm trigger (similar to a cron job). All three actions will be implemented in Python, using the Python runtime provided by OpenWhisk. Here is what action sequence does with its triggered flow.

...

  • Retrieve Slack History - An action that is invoked every 24 hours with OpenWhisk slack domain and a particular channel, retrieves a bunch of messages and user map. It than then replaces user ID with user name in all the slack messages and sends them sends them to next action in sequence. For example, user ID "XYZ" is replaced with username "bob":

language
Code Block
languagejs
   {
        "type": "message",
        "user": "XYZ",
        "text": "Did my email about Slack made it to the dev list?",
        "ts": "1484957540.000002"
    },
Code Block
js
   {
        "type": "message",
        "user": "bob",
        "text": "Did my email about Slack made it to the dev list?",
        "ts": "1484957540.000002"
    },

 

  • Format Slack History -  An action invoked by retrieve slack history action. It takes a list of slack messages and drops messages with "subtype" of "channel_join". It runs messages to through message builder for basic formatting formats messages to group and some advanced restructuring of messages including grouping parent messages and replies together.  

 

  • Send Email to Dev List - An action invoked by format slack history action, receives formatted slack messages and sends email to dev list.