Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Automatically Generate Tokens

  • d90
  • d90's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 1 month ago #124769 by d90
Automatically Generate Tokens was created by d90
Is there any way to automatically generate tokens? I mean, I have to imagine since there is a button to generate tokens there should be a way to call that function on the back end without having to physically press it with the mouse. Is this possible?
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 1 month ago #124770 by holch
Replied by holch on topic Automatically Generate Tokens
You mean you want to create them via the API?

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • gabrieljenik
  • gabrieljenik's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
9 years 1 month ago #124771 by gabrieljenik
Replied by gabrieljenik on topic Automatically Generate Tokens
You could do a loop calling the add_participant remote control function N times.
www.limesurvey.org/manual/RemoteControl_2_API#add_participants

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Checkout our Reporting Solutions and our plugin shop at www.encuesta.biz .

The topic has been locked.
  • d90
  • d90's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 1 month ago #124791 by d90
Replied by d90 on topic Automatically Generate Tokens
I guess I should have provided more info. I'm using 1 survey for customer satisfaction. I'm importing info into the tokens table from my company's completed orders database. I want limesurvey to create the tokens for those imports rather than me writing an rng for it. So i guess any way that I can automate that portion would be awesome. Full disclosure though: I don't know how to utilize an API. I'm not a programmer so this is new ground for me.
The topic has been locked.
  • d90
  • d90's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 1 month ago #124793 by d90
Replied by d90 on topic Automatically Generate Tokens
Can the add_participants remote control add _only_ the token to the table? I'm only looking for the unique id to be generated similarly to the 'generate tokens' button under token management.
The topic has been locked.
More
9 years 1 month ago #126177 by mwooldri143
Replied by mwooldri143 on topic Automatically Generate Tokens
How are you adding the tokens to the survey table? I'm using Limesurvey for a customer satisfaction survey too, and though I am not a professional programmer I did manage to write a bit of php code that takes our phone call log and directly generates invitations, along with a generated "token" (for me, each customer has an "account" number which I scramble a little bit) by putting entries directly into the mysql table. It wouldn't take much php code to generate a random number that could be used as a token.

If you're importing a .csv file, then at the bare minimum you're importing a file with three headers. It would be relatively trivial to open up the .csv file in excel and add a column titled "tokens" and use RANDBETWEEN(X,Y) to generate random numbers for all of the entries. Then save this new .csv file and use that instead.

I have no idea what LDAP is so I can't advise there.
The topic has been locked.
  • d90
  • d90's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 1 month ago - 9 years 1 month ago #126179 by d90
Replied by d90 on topic Automatically Generate Tokens
Well before I explain that, it would help to know how we're using Limesurvey. We're a Franchisor. Our franchisees purchase equipment from us. Every time they purchase equipment, they will fill out a short satisfaction survey. It's always the same survey.

I created a stored procedure in MS SQL 2008 R2 to pull some basic info about the franchisee's order into my survey's token table. The part about crypt_gen_random(10) as token gives me a value which is then converted for use as the actual token value. I then fire off all order survey emails. This occurs daily. I don't necessarily like this method (of generating the tokens) as I feel the limesurvey software does it better.

Warning: Spoiler!
Last edit: 9 years 1 month ago by d90.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose