SlackAPI logoFilterAPI logoCodeAPI logoStorageCLIAPI@1.2.1 logoStorageCLIAPI@1.2.1 logoFilterAPI logoStorageCLIAPI@1.2.1 logoOpenAiCLIAPI@1.17.3 logoZapierFormatterCLIAPI@1.0.4 logoZapierFormatterCLIAPI@1.0.4 logoSlackAPI logoStorageCLIAPI@1.2.1 logo

OpenAI Sentiment as Slack Status

Updates my Slack status based on sentiment analysis of recent messages sent in Slack. This helps me because... ...physical emotional cues (facial expressions, posture, etc.) can be lost when working remotely. This helps to fill that gap. ...it helps me to check-in on my tone. If I'm coming off like a jerk, I'd like someone to tell me so that I can change my tone. NOTES ON STEPS - Step 2 - I filter to only messages sent by my User Name. I also filter out messages that contain keywords that may indicate that the contents are private (i.e. things like "private," "$," "password" etc.). Step 3 - To shorten the messages for cost-saving purposes, I remove URLs and only use the first 500 characters of the message with the following JavaScript code block: ``` let text = inputData.text; [...text.matchAll(/http(.*) /g)].forEach(match => { text = text.replace(match[0], ""); }); output = {text: text.substring(0,500)}; ``` Step 4 - Push the value of the output of step 3 onto a list. I use the key `messages`. Step 5 - Increment the value of a key `messageCount` by one. Step 6 - Only proceed if the `messageCount` is greater than 4. Step 7 - "Key" is "messages". "Item format" is " %s". Step 8 - I've had the best success with the "text-davinci-003" model. I use the defaults for the rest. My prompt is: ``` Describe the sentiment in these Slack messages using three words and one emoji. The words should be surrounded by "||". The emoji should be surrounded by "$$". Example response: ||Word1, Word2, Word3|| $$:emoji:$$ ### {{insert Step 7s Output here}} ``` Step 9 - Extract the words by using the "Split text" transform. The input is the "Choices Text" from Step 8. Separator is ||. Segment index is 1. Step 10 - Extract the emoji. Same as Step 9, but the Separator is $$. Step 11 - Use the output of Step 9 for the Status Text. Use the output of Step 10 for the Status Emoji. I set the Expiration Time to 60 minutes. Step 12 - Reset the Storage by using "Set Multiple Values" Event. Key of `messageCount` is set to 1. Key of `messages` is set to nothing (i.e. leave the input blank)

Mike Lambertcreated by Mike Lambert
How Zapier works (57 sec)
How Zapier works (57 sec)
Try this Zap FREE for 14 days

Trusted at companies large and small

This Zap works in 12 steps

  • 10 minutes to set up
  • Get back 71.6 hrs /week
  • 23 people use this zap

This Zap uses the following 6 apps

  • Slack logo
  • Filter by Zapier logo

More ways to use these popular apps!

Check out all the other ways you can connect Slack and Filter by Zapier.
Learn More