Best answer

Powering a Dynamic Drop Down with a Polling Trigger

  • 16 July 2022
  • 1 reply
  • 89 views

Badge

Hey everyone! I’m working on a project and have hit a dead end that’s a little outside of my knowledge that I hope someone might be able to clarify and point me in the right direction on.

For context, I’m building a custom connector for a service that has a stock connector that doesn’t include some endpoints/actions that I need to use. I have a lot of experience building really simple action-only connectors for services that use OAuth to grab an extra endpoint that’s missing from a stock connector, but I’ve never tried to build in polling triggers to power drop downs in my action steps to reduce amount of data that might need to be supplied to an action step manually.

Here is the example that I’m working on now:

I’m working with the Webflow CMS API: https://developers.webflow.com/#cms-api-reference

The stock connector is good, but it lacks functionality to do some simple list returns as well as patch calls on object related fields. You can do these (and I do often) with the Webhooks app as a custom request, but you leave a single-user personal API key exposed in Zapier and it’s not as a robust in the event that the Webflow user is deleted from the main account.

I’ll just run through an example - If I’m trying to patch a CMS collection item in Webflow via an action I’ve made in Zapier (and we’ll simplify this to just pass the fields JSON Webflow needs instead of making that more human ready haha), I’d need to give it the following pieces of info:

My action might look like this:

Item ID & Gallery JSON I pull from previous steps, but the collection ID has to be specified by the user. Not a huge deal, but I’m trying to figure out how to replace that field (and other instances of this that make men more sense than this action) with some dynamic drop downs that will populate collections for the user to choose. What that looks like on the Webflow side is performing two GET requests to list sites and the collections by site. Webflow does this in their own connector, and this is what is looks like:

Now, I think I understand the basics of how to do this, I’m just getting tripped up in the formatting of the response data. Both of these GET requests work fine as auth tests and they both return an array of objects that are then processed to fill these fields. I assume I need to make hidden polling triggers that access the proper endpoints and then process that data and return fields in the correct schema, but that’s where I’m stuck 💀

If we look just at listing sites for example, here is what I’m seeing in the developer Platform. The request config is simple:

Here is the code version - totally standard:

And I’m getting a code 200 successful response, but the platform doesn’t like it because I’m clearly missing a step where this needs to be properly parsed and assigned to fields (or something hah!). Here is some sample response data (from the API reference - exact same structure as mine, just doesn’t reveal site data):

[
{
"_id": "580e63e98c9a982ac9b8b741",
"createdOn": "2016-10-24T19:41:29.156Z",
"name": "api_docs_sample_json",
"shortName": "api-docs-sample-json",
"lastPublished": "2016-10-24T23:06:51.251Z",
"previewUrl": "https://d1otoma47x30pg.cloudfront.net/580e63e98c9a982ac9b8b741/201610241603.png",
"timezone": "America/Los_Angeles",
"database": "580e63fc8c9a982ac9b8b744"
},
{
"_id": "580ff8c3ba3e45ba9fe588bb",
"createdOn": "2016-10-26T00:28:54.191Z",
"name": "Copy of api_docs_sample_json",
"shortName": "api-docs-sample-json-086c6538f9b0583762",
"lastPublished": null,
"previewUrl": "https://d1otoma47x30pg.cloudfront.net/580e63e98c9a982ac9b8b741/201610241603.png",
"timezone": "America/Los_Angeles",
"database": "580ff8c3ba3e45ba9fe588bf"
},
{
"_id": "580ff8d7ba3e45ba9fe588e9",
"createdOn": "2016-10-26T00:29:13.634Z",
"name": "Copy of api_docs_sample_json",
"shortName": "api-docs-sample-json-ce077aa6c5cd3e0177",
"lastPublished": null,
"previewUrl": "https://d1otoma47x30pg.cloudfront.net/580e63e98c9a982ac9b8b741/201610241603.png",
"timezone": "America/Los_Angeles",
"database": "580ff8d7ba3e45ba9fe588ed"
}
]

And here is what the platform is telling me:

With this additional error message (I’ve subbed in values to obscure my data - but I have all the same fields in my response 1:1):

Invalid API Response:
- Got a result missing the "id" property ({"_id":"580e63e98c9a982ac9b8b741","createdOn":"2016-10-24T19:41:29.156Z","name":"api_docs_sample_json","shortName":"api_docs_sample_json","lastPublished":"2016-10-24T23:06:51.251Z","previewUrl":"https://d1otoma47x30pg.cloudfront.net/580e63e98c9a982ac9b8b741/201610241603.png)
What happened (You are seeing this because you are an admin):
Executing triggers.list_sites.operation.perform with bundle

Soooo… I’m clearly not there 😅 I think I understand what it has to do with, but I don’t know how to proceed. I found this really good discussion that’s very closely related, but I couldn’t quite adapt it to a simple polling tigger to use as the basis of a drop down.

Hoping some altruistic angel on staff or in the community can help me sort this out. Thank you so much!

icon

Best answer by Alchemick 18 July 2022, 04:33

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

Badge

Solved! I was overcomplicating this - needed to map an id field and filter dupes and it’s working great :)