Laurence Gonsalves
Laurence Gonsalves

Reputation: 143274

In Zapier, how do I get the inputs to my Python "Run Code" action to be passed in as lists and not joined strings?

In Zapier, I have a "Run Python" action triggered by a "Twitter" event. One of the fields passed to me by the Twitter event is called "Entities URLs Display URL". It's the list of anchor texts of all of the links in the tweet being processed.

Zapier is passing this value into my Python code as a single comma-separated string. I know I can use .split(',') to get a list, but this results in ambiguity if the original strings contained commas.

Is there some way to get Zapier to pass this sequence of strings into my code as a sequence of strings rather than as a single joined-together string?

Upvotes: 1

Views: 256

Answers (2)

mbernasocchi
mbernasocchi

Reputation: 843

You can do that using Zapier's catch raw webhook action. See https://stackoverflow.com/a/77099781/1193450 for a complete description

Upvotes: 0

xavdid
xavdid

Reputation: 5262

David here, from the Zapier Platform team.

At this time, all inputs to a code step are coerced into strings due to the way data is passed between zap steps. This is a great request though and I'll make a note of it internally.

Upvotes: 2

Related Questions