Skip to main content

Hello,

I have a step in my Zap where I need to retrieve a bearer token to use for a later step. This token can be retrieved within a response from a python request.

My response in Zapier looks like this:

 

output_missing

Please define output or return early.

id

8KzjgJ7iu86HBhkCxXu5L8hSoc5sD3Qq

runtime_meta

memory_used_mb

47

duration_ms

857

logs

1

{"expiresAt":"2021-12-22T02:13:20Z","cultureId":1,"companyAccountId":20,"userAccountId":47,"newUrl":null,"refreshToken":"z8+7NQrtekQ35vrR6l03cn+V4mL6CBazO0WACqYjzM0=","token":"{TOKEN}","role":"CorporateInterpreterRootAdmin"}

 

 

I need to extract the {TOKEN} value and be able to re-use it as a field in a later action step.

I tried a few output/return options, but I’m not sure how to do this.

 

Any ideas?

 

Thank you

Thomas

Hi @Thomas2M 

You can use python for this (read Zapier python help docs on how to format your code) or you can use formatter>text>extract pattern and use a regex query to extract the token part. This should be more convenient to work with.

 


Hi @robschmidt,

Thank you for pointing me out in the right direction. The formatter with python regex did the trick.

In case this is helpful for the forum users, here’s the regex I used: (?<="token":").+(?=",)