Bot ask a question not showing any further options?

(Siddharth Hemrajani) #1

Hello everyone?
I am new to the platform and am trying to make the bot ask a question and give some options for the user to select.
My friend had shared a flow with me where he was able to do that using Bot - Ask a question option.In the next screen it asked for the question and possible options.But when am trying to create a new from scratch, when i hit Bot-Ask a question , it doesnt give me any option like that, am i missing something? Please let me know

(John Jackson) #2

Sounds like you might need to select the choice option from the dropdown when you set up the question.

Did you do that?

(Siddharth Hemrajani) #3

Didn’t get any options, it went from Bot-Ask a question to name the action,
then save ,nothing else

(John Jackson) #4

It’s actually on the first step, before you add a filter or change the name, it’s labelled question type.

(Siddharth Hemrajani) #5

Okay,this time I tried it again, now it’s showing the options page. Last
time it didn’t , I have used ask a question before.

Anyways,thank you

(John Jackson) #6

Great! Don’t know what happened but glad it’s working now.

(Siddharth Hemrajani) #7

Hey there!
Does the code<> support JavaScript HTTP calls?

(John Jackson) #8

It does, by exposing the node-request library. There’s an example script here:

http://support.flowxo.com/article/145-code

If all you need to do is fetch data from an API, you might be better served by using the webhook service. You can call an API, and then access the data in the response further on in your flow.

(Siddharth Hemrajani) #9

Hello ,
I have a persisting problem with the HTTP requests i have been making via
the flow.xo platform.
I first tried to do it via web-hook service, and then with the code<>
service

Whenever i try to pass a token received via another web hook action to a
code action, it happens to add “\n” to the token in the end. I have also
tried replacing “\n” with “” by using javascript functions but it doesn’t
work
I am attaching the code and screenshot of the log below .
if you can’t open the code file , here’s the raw code .The two screenshots
are for the trials of code and web hook service. Both failed due to invalid
token. I have also tested the REST service before
I works there with the same inputs.
Thank you for your patience.

var url = inputs.url;
var token = inputs.token;
var modified_token = token.replace("\n", “”);
var opts = {
method: ‘GET’,
url: url ,
inputs: {
token: modified_token,
format: “json”,
language: “en-gb”
}
};

utils.request(opts, function(err, resp, body) {
if(err) {
return reject(err);
}
resolve(body);
});

But when the token is sent to REST service , it adds “\n” to the token, and
hence I get a 400. Missing or invalid token
.

(Siddharth Hemrajani) #10

<javascript:_e(%7B%7D,‘cvml’,‘siddharth.dny@gmail.com’);>>
showing any further options?*
<javascript:_e(%7B%7D,‘cvml’,‘replies%2Ba8b4bbd721ddf6fa2993e8d18e7a522a@flowxo.com’);>

<javascript:_e(%7B%7D,‘cvml’,‘siddharth.dny@gmail.com’);>>
showing any further options?*
<javascript:_e(%7B%7D,‘cvml’,‘replies%2Ba8b4bbd721ddf6fa2993e8d18e7a522a@flowxo.com’);>

Hello ,
I have a persisting problem with the HTTP requests i have been making via
the flow.xo platform.
I first tried to do it via web-hook service, and then with the code<>
service

Whenever i try to pass a token received via another web hook action to a
code action, it happens to add “\n” to the token in the end. I have also
tried replacing “\n” with “” by using javascript functions but it doesn’t
work
I am attaching the code and screenshot of the log below .
if you can’t open the code file , here’s the raw code .The two screenshots
are for the trials of code and web hook service. Both failed due to invalid
token. I have also tested the REST service before using resttesttest
I works there with the same inputs.
Thank you for your patience.

var url = inputs.url;
var token = inputs.token;
var modified_token = token.replace("\n", “”);
var opts = {
method: ‘GET’,
url: url ,
inputs: {
token: modified_token,
format: “json”,
language: “en-gb”
}
};

utils.request(opts, function(err, resp, body) {
if(err) {
return reject(err);
}
resolve(body);
});

.

(John Jackson) #11

Can you please send me the output from your webhook where you get the token and the input to your action where you use the token?

Obviously you need to remove any sensitive data. I didn’t see the screenshot on your last post.

(Siddharth Hemrajani) #12

hello,
This is my web hook code .

import requests
import json
import time
header = {‘Content-type’: ‘application/json’,‘Authorization’: ‘Bearer ***********************’ }
url = ‘https://sandbox-authservice.priaid.ch/login
response = requests.post(url, headers = header, verify=False).json()
time = time.time()
latest_token = response [‘Token’]
print latest_token

This is the output, the output token changes every time the hook is called
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InNpZGRoYXJ0aC5kbnlAZ21haWwuY29tIiwicm9sZSI6IlVzZXIiLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9zaWQiOiI1MTkiLCJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3dzLzIwMDgvMDYvaWRlbnRpdHkvY2xhaW1zL3ZlcnNpb24iOiIyMDAiLCJodHRwOi8vZXhhbXBsZS5vcmcvY2xhaW1zL2xpbWl0IjoiOTk5OTk5OTk5IiwiaHR0cDovL2V4YW1wbGUub3JnL2NsYWltcy9tZW1iZXJzaGlwIjoiUHJlbWl1bSIsImh0dHA6Ly9leGFtcGxlLm9yZy9jbGFpbXMvbGFuZ3VhZ2UiOiJlbi1nYiIsImh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vd3MvMjAwOC8wNi9pZGVudGl0eS9jbGFpbXMvZXhwaXJhdGlvbiI6IjIwOTktMTItMzEiLCJodHRwOi8vZXhhbXBsZS5vcmcvY2xhaW1zL21lbWJlcnNoaXBzdGFydCI6IjIwMTYtMDctMjMiLCJpc3MiOiJodHRwczovL3NhbmRib3gtYXV0aHNlcnZpY2UucHJpYWlkLmNoIiwiYXVkIjoiaHR0cHM6Ly9oZWFsdGhzZXJ2aWNlLnByaWFpZC5jaCIsImV4cCI6MTQ2OTk5MzUxMSwibmJmIjoxNDY5OTg2MzExfQ.mYDqKVjrx4DaKNp1gNOu1kD0svk4JNQNs6zJxR0oT3M

There is the JS code where i use this token,
var url = inputs.url;
var token = inputs.token;
var modified_token = token.trim();
modified_token = modified_token.trim();
var opts = {
method: ‘GET’,
url: url ,
inputs: {
token: modified_token,
format: “json”,
language: “en-gb”
}
};

utils.request(opts, function(err, resp, body) {
if(err) {
return reject(err);
}

resolve(body);
});

(John Jackson) #13

The info you sent is a little hard to digest, I can’t figure out what you’re doing there.

So if the token comes through with an extra \n I’d probably try to use the Text (String) service to deal with it. You might find that easier than code.

You might need to split on \n and take the first part, because I don’t think you can yet replace with an empty string.

Hope that helps.