Created
March 29, 2016 20:07
-
-
Save benstevinson/34697fa7b714bc47c6b4e183931f7e92 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define all sales agents. To add an agent, just add them to this list. | |
sales_agents = ["Sales Agent 1", "Sales Agent 2", "Sales Agent 3"] | |
# Client secret for our one stored value. | |
store = StoreClient('{Generate a random 30ish character passphrase and put it here}') | |
# Grab the previous sales agent | |
previous_agent = store.get('agent') | |
# This is a bit janky because Zapier doesn't support itertools. | |
if previous_agent: | |
# If at end, reset to beginning | |
if previous_agent == sales_agents[-1]: | |
agent = sales_agents[0] | |
else: | |
agent = sales_agents[sales_agents.index(previous_agent) + 1] | |
# If no agent is stored, set as first agent in list. | |
else: | |
agent = sales_agents[0] | |
# Store away our sales agent | |
store.set('agent', agent) | |
output = {'sales_agent': agent} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment