Pendo API - Unable to use startsWith in the pipeline filters

Would love some help/brainstorming with this painful issue I am facing. I am using startsWith expression in my pipeline filters.. but i keep getting an error. As per the Pendo API docs (https://developers.pendo.io/docs/?python#expressions) it looks like startsWith is a legal expression. What am I doing wrong?

What I am trying to do

Get a list of visitors who's email address does not start with `anonymous+` . I am also getting their first visit date and their last visit date.

How I am doing it

I am calling the pendo API (code below) and using this as the filter condition:

  • {"filter": "(firstvisit >= 1638662828092.9492) && (email!=null)  && (!startsWith(email, 'anonymous+'))"}

What's going wrong

When using `startsWith` expression in filter, I keep getting an error that the pipeline parameter could not be parsed:

  • bad pipeline: aggregation pipeline step 5 parameter error: Cannot parse filter expression

 

Code that I am using

url = "https://app.pendo.io/api/v1/aggregation"

payload = json.dumps(

{

"response": {"mimeType": "application/json"},

"request": {

"pipeline": [

{"source": {"visitors": None}},

{"identified": "visitorId"},

{"eval": {"visitorId": "hash(visitorId)"}},

{

"select": {

"email": "metadata.agent.email",

"firstvisit": "metadata.auto.firstvisit",

"lasttvisit": "metadata.auto.firstvisit",

}

},

{"filter": "(firstvisit >= 1638662828092.9492) && (email!=null)  && (!startsWith(email, 'anonymous+'))"},

]

},

}

)

headers = {

"X-Pendo-Integration-Key": "my-api-key",

"Content-Type": "application/json",

}

r = requests.request("POST", url, headers=headers, data=payload)

# Export the data for use in future steps

return r.json()
0

Comments

0 comments

Please sign in to leave a comment.

Didn't find what you were looking for?

New post