Need help getting multiple values from google sheet into one slack message

First, thank you and please bear with me. I’m new to make (but not to programming) and I’ve been reading/watching videos all day.

  • I created a scenario where I watch Zendesk tickets, grab the requester comments, send those to chatGPT for sentiment analysis, and then add a row for each ticket ID to a google sheet with the sentiment as ‘positive’, ‘negative’, or ‘neutral’. That’s working fine. I get an output bundle like the one below.

[
{
“0”: “74558”,
“1”: “Based on the given ticket description and comments, it appears that the customer is inquiring about the charges associated with using the service for credit card processing. \n\nSince the customer is seeking information and asking a straightforward question without expressing any dissatisfaction, frustration, or negative sentiment, the customer sentiment for ticket 74558 can be categorized as neutral.”,
“2”: “negative”,
“3”: “317001”,
“4”: “2023-09-06T00:16:07.000Z”,
“5”: “2023-09-12T15:05:07.000Z”,
“6”: “Associated Services”,
ROW_NUMBER”: 4,
SPREADSHEET_ID”: “1jEasB1NAsxQmA72Z1gonxp3cRGGG2V6o92s5ZtKl2do”,
SHEET”: “Description and Public Comments”,
IMTLENGTH”: 24,
IMTINDEX”: 1
}
]

I want to then create a slack message that ultimately says something like

Positive: countPositiveComments
Negative: countNegativeComments
Neutral: countNeutralComments

On my screenshot, the filter numbers for pos, neg, and neutral match the tallies on my google sheet. Awesome.

But then I get stuck simply trying to create the slack message. I have tried many different paths of iterators and aggregators today but I think what I fundamentally don’t understand is how to take the 3 different sentiment values and put them back into one module for use. It doesn’t seem there is anyway to “re-route” the paths back together.

I’m sure there must be a simpler way to create those variables and send them to slack? :sweat_smile:

Welcome to the Make community!

I think splitting them into different routes is not necessary, you could just use the inline if built-in function to set each variable.:

Value:
{{ if(1.sentiment = "negative"; <value-if-negative>; if(1.sentiment = "positive"; <value-if-positive>; <value-if-neutral>)) }}

Screenshot_2023-09-28_113520

WIthout knowing what the scenario does, it’s hard to provide additional specific advice.

Could you please share screenshots of the module fields and filters in question? It would really help other community members to see what you’re looking at.

You can also export the scenario blueprint file to allow others to replicate the issue. At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.

Screenshot_2023-08-24_230826

Uploading it here will look like this:

blueprint.json (12.3 KB)

If possible, could you also please provide the input/output bundles of the modules by running the scenario, then clicking the bubble on the top-right of each module, taking screenshots of, and copying the contents into this discussion thread:

Screenshot_2023-08-29_100800

This will allow others to better assist you. Thanks!

2 Likes

Glad to be here and thanks for getting back to me so quickly :grinning:

Absolutely. Here is the blueprint and the screenshot from the output. I only included the positive path in the screenshot, since negative and neutral are redundant (which already tells me there is a better way - DRY! - but am utterly confused now about how to proceed with make).

Once I have the number of positive, negative, and neutral comments, I want to trigger a slack message with those counts. Something like

Today’s customer sentiment analysis is as follows:

  • Positive: {Positive Variable}
  • Neutral: {Neutral Variable}
  • Negative: {Negative Variable}

Thanks again for taking a look!

blueprint.json (149.2 KB)

it’s limiting me to 10 attachments.

1 Like

Thanks for the blueprint, it really helped me understand what you’re trying to achieve.

Every result (item/record) from a search module will output a bundle. To “combine” them into a single structure, you’ll need to use an aggregator of some sort.

Aggregators are modules that accumulate multiple bundles into one single bundle. An example of a commonly-used aggregator module is the Array aggregator module.

I’ve managed to reduce your router + three branches into just two modules - an array aggregator, and a text aggregator:


(the first module mocks/represents your Sheets search module - I’ve used the JSON from your first post above)

1. Array Aggregator (expand advanced settings and set Group by)

2. Text Aggregator

Output

Demo Blueprint (please create a new scenario - do not override existing)

blueprint.json (6.7 KB)

3 Likes

Oh this is excellent. I kept trying different things with aggregators and iterators but the piece I was missing was the group by and the text aggregator at the end. Makes so much sense now.

Just to get a POC going I ended up grabbing the 3 variable values I needed out of my google sheet as cells (because I had a tab there doing the calculations) but this is far superior.

Thank you again!

2 Likes