Create Name List From External Database for Poll

(Ryan Nails) #1

Hello

Currently my company task me to create a simple poll, to vote for the best employee of the month in the office with a Telegram Bot

My boss wanted me to create buttons for each of the employees name… So if someone want to vote for a person, they will just tap one of the name that appear instead typing the name to saves time.

The list of the employees name was on the external MySQL database.

Is it possible to GET the name from my database, and then put it as CHOICES in the flow?

So far, all I know is I have to type each CHOICE and the value every time i create a flow… We have 20 employees and we want as a CHOICES button, instead typing the name to vote…

Thank you…

(Sarah Palombo) #2

Hi Ryan :wave:

This article (below) will help as it’s a similar example. (reach another service using a HTTP request, then use Data Outputs to provide choices)

So you’d get the employee names from the DB, you can then send a choice question. Using choices you can use the XO icon and choose the first choice (dataoutput1) then for the second choice use the XO icon and choose (dataoutput2) etc etc

The article shows more if you get stuck email support@flowxo.com we can help you from there.

The only Tip I think you’ll make use of is that there are 10 choice options that you can have so perhaps send 9 options with a + more choice where you then send another set 10, 11 12 etc

Hope that helps ! :slight_smile:

(Ryan Nails) #3

Hi, Sarah

Thanks for the answer…

I tried your guide and I’m struggled a bit. I hope you can help me with this one.

So basically what I want to achieve is to make the list of my employees name appear like this on the Telegram Bot:

“Hello, the employees on your department are Name1 (Employee ID), Name2 (Employee ID), Name3 (Employee ID), & Name4 (Employee ID)”

so at least user know the employee ID, after that they just input the ID number and the poll will be added into my database.

So here’s what I did.
Create a MySQL Flow >> Run a Query

“SELECT name, empID FROM my_table WHERE department = :department”

Create a Webhook & HTTP Request

Method: GET
Content Type: JSON
Request URL: My MySQL URL

Now, I’m stuck in here since I don’t really understand how to GET the data from MySQL using this request. I only have a database from my hosting. I don’t have an API or form or whatever.

Here’s what my database look like:

(Karen Barker) #4

Hi Ryan,

If you’re using our mySQL integration then I don’t think you’ll need to do the HTTP Request. If you can remove the HTTP request, run your flow and then email us at support@flowxo.com including a screen shot of the interaction details then I’ll definitely be able to help you with how to display the details. :thumbsup: