Text Aggregator for WhatsApp Bot with GPT

Good afternoon everyone, how are you?
I made a What’s App customer service bot using gpt chat, it was very good. However, one detail was missing: I need to combine all messages sent by customers within a 30-second interval, so that each message is not answered individually when it comes to a single question.
I tried to do this with the TextAggregator but it didn’t work, as the other instances don’t receive the information from the webhook if I have the TextAggregator in the middle.

Welcome to the Make community!

You can set the Webhook scenario to run once every minute and combine (aggregate) all the requests it has received in the past minute.

Screenshot_2024-01-03_230137

1 minute is the minimum interval, you cannot do 30 seconds.

2 Likes

OK i did that, but if i receive 2 messages it goes to Bundle 1 and Bundle 2.
How do i combine this 2 Bundles in only one message?

Thank you

Every result (item/record) 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.

If you want a single text/string variable, use a Text Aggregator module.

2 Likes

Ok thank you verry much. I did it and it is working fine!
I would like to use the other option of running the program as soon as I receive the data, because this way I am running the program for nothing and spending a lot of money. Is there no way to be able to gather these messages in the Aggregator without using this option of running the program every 1 minute? I thought about doing this with sleep but it’s not working. Can you help me?
I only want to aggregate all the data i receive in 30 seconds.

I think the options you have is either you handle them immediately, or set a schedule to run the scenario to process the webhook queue.

You could try logging all the items into a spreadsheet immediately, and use another scenario to read the items from the spreadsheet entered in the past minute to do the rest of your original scenario (GPT, send message, etc.)

2 Likes

OK the spreadsheet is a good option, but do i really need another scenario?
I thought about sending the data to spreadsheet that will be waiting for new data by the sleep 30 seconds, só after 30 seconds array interator will collect the data, then array aggregator will send than to chatgpt. Does it works?