Location not working when followed by Bot-send message

(Peteredel) #1

Hello,
Building a bot that requires the location of the user.

I implemented successfully a request location for Messenger and Telegram. ( flow 1)
It picks up the location correctly via a 2nd flow that receives the location.

However, when there is a Bot-send message AFTER the location request in flow 1, then the location request is not shown anymore.

I added other services between the location request and the bot-send message, but that did not help.

How to solve?

(Peteredel) #2

remark : I think flow1 should wait until flow2 has finished with capturing the location before it continues with services after the location request

(Steven Booth) #3

Hello Peter

At present, the solution you have in place with two different flows is the best one.

Since we’re making an external request, there’s a danger that waiting for a response could be detrimental to the rest of the Flow - for instance, if the request times out (as a webhook mid Flow), the rest of the flow won’t run.

So in this way - with two flows - we can sure to get something sensible every time Flow 2 is triggered.

Thanks

Steven

1 Like
(Peteredel) #4

Steven,
I already require 2 flows :
Flow 1 to request the location, this is the ‘business flow’ with the user.
Flow 2 is needed to receive the location ( File method)

The problem is that I need to continue in flow 1 after I have the location of the user.
However, if there is another user interaction, the location request is not shown anymore

(Steven Booth) #5

Hey Peter,

Apologies - What I mean is that it not a requirement to continue in Flow 1, it’s just optional.

After you trigger Flow 2 - you can do everything that you planned to do in Flow 1 in Flow 2, as the ‘New File’ trigger in Flow 2.

If you need extra detail about the customer in Flow 2 that you’ve previously asked for, you can trap that data as attributes (Set an Attribute) and which will then be available in the trigger of Flow 2 as outputs.

Thanks,

Steven

(Peteredel) #6

In flow 2 : how do i detect that the caller is flow1 ?
Flow2 is a file trigger, it means that when a user sends an image, movie or location it also triggers this flow.
Can I limit/filter flow2 in a way that I only get triggered if the file location is requested from flow1?

(Steven Booth) #7

Peter,

We need to use filters on the trigger in Flow 2 in that case.

The trigger gives us an output ‘File Type’ which we can filter for ‘location’.

Thanks,

Steven

(Peteredel) #8

Steven,
Please read my question again, I know it is a location, but the filter should also be based on what flow is calling.
Flow 2 is the continuation of Flow 1, so after receiving the location in flow 2 the script continues

The problem that still exists ;

If a user sends a location at any other moment, then the same flow 2 with filter location is triggered, and flow 2 continues as if it had been called from flow 1.
This is NOT how it should work.
I need a way to know that flow 2 is triggered by flow1 ( and of course by type=location)

(John Jackson) #9

Forgive me I’m trying to follow the thread. I think what you need is a ‘Ask for Location’ action which works like ask a question but requests (and waits for) the location.

But of course, although we’ll almost certainly introduce this in the not too distant future, we don’t have this yet.

So until then, your best (only?) option is to use attributes to know what has come before it. So set a location_requested attribute to true in flow 1.

You might actually want to reset this flag and other flows too, i.e. set location_requested to false (or empty).

Then in your flow 2, use a filter to check {{attributes.location_requested}} is true.

This is all assuming you have different uses for a location. A lot of bots only use location for one thing, in which case it’s probably sensible just to assume it’s been requested or the user knows what will come next.

(Peter Edel) #10

John,
Correct, can you just explain me how I create the filter with output/condition/value?

(John Jackson) #11

Sure! On any trigger or task, just before the final step (where you name the trigger/action) you’ll be able to add filters.

So you select the output from the list (the value you want to check), this can either be a value that is an output of the trigger, or any previous actions. You then choose what kind of match you need ‘is’, ‘is not’, ‘greater than’ etc… On the RHS you’ll then say what you want to check against. In this case, we’re using a flag that we’ll set to true, so we check for the text true.

There’s more info on using filters here: https://support.flowxo.com/article/31-filters

(Peter Edel) #12

John,
Thanks. I overlooked the pencil in the output that enables custom outputs
This solves my problem !

Strange that I only get a result when I check my attribute ( with the name status) when I use the underscore underscore method
{{ontvang.attributes__status}}

(John Jackson) #13

Oh great. We are intending on making it more obvious how to filter on attributes like this. It’s not good enough currently, too confusing/obscure.

The double underscore way is the only way it will work :slight_smile: