Google Search to trigger a bot message

(Tim) #1

Hi,
I’d like to be able to control the content of bot chat in messenger using content from google spreadsheet. By having questions and answers in the google sheet, I can change them without changing the flow.
The problem is I can’t get the bot to trigger after the google search. Any ideas?

Thanks

(Kellsey Shaw) #2

Hi Tim,

You’re almost there but you’d want to use the Google Sheet List Rows instead.

Your current flow is searching for the bot message (maths) in the trigger column of your spreadsheet but you don’t have anything that matches that so there is no output for the question or choices of the next question, which is why the question isn’t asked.

Getting the list of rows would return all the rows of the sheet and you can use the Collections Outputs to be able to select a particular row number.

Looks like you’re onto something good with this use case :+1:

(Tim) #3

Great thanks that worked. Now I just need to get the bot to keep looping through the rows and giving feedback for each answer :slight_smile:

Any pointers would be very helpful, I’m getting close to my 100 a month limit.

(Kellsey Shaw) #4

If we’re sticking with the code free options, there are two ways to do it.

If you want to work with a set number of questions each time you could ‘ask a question’ for each possible row and use the connections outputs to select the row for each of the questions.

But, if you were using a different number of questions each time you updated the sheet you’ll need to take a different approach.

You’ll want to add an extra column to your sheet and populate the cells with the row numbers (Google Sheets doesn’t give us human-friendly row numbers on the integration so you’ll you need to add them in a column) and you’ll want to use the Google Sheets Search to search for the row number in the column that you’ve added.

The Attributes service is perfect for keeping a counter so that you can loop through the row numbers. When you are setting an attribute you can say {{myNumber}} +1 to increment it by 1.

Keeping that List Rows task in there will work well for the first time that the user comes to the bot because there will be no attribute stored the first time round. You could filter out the task that searches the number and instead use the first row from the list rows task if there’s no attribute value available.

All you need to do if the Get Attribute task returned nothing, is make sure to set a new attribute before the end of the flow. Then the next time the user visits, there will be an attribute with a value in it and you can use it to search the row number.

Hopefully, this all makes sense :slight_smile:

1 Like
(Tim) #5

Thanks that’s really helpful. I’ve started playing with the attributes feature. The problem is whilst experimenting with this messenger keeps sending a message ‘Answer with .’ Every 20mins tried quit unsubscribe end stop update commands and it just keeps going… how can I stop it?

(Kellsey Shaw) #6

Hi Tim,

It looks like there’s something causing an issue with the question reminders at the moment. We did notice this over the weekend and have already got the engineers working on it to fix whatever is causing the bots to keep pestering users.

If you’re still being pestered you can just stop the bot by deleting the conversation. Don’t worry, though, we’ll have it fixed very soon.

(Kellsey Shaw) #7

Hi Tim,

Our engineers have managed to track down the bug causing the questions to carry on and it’s now been resolved

(Tim) #8

Thanks

Get Outlook for Androidhttps://aka.ms/ghei36

#9

Great information @kellseyshaw
Thank you so much