How to use the post_poll method in Zapier CLI

后端 未结 1 896
再見小時候
再見小時候 2021-01-24 05:15

According to the docs, I should use a post_poll function to add the missing id field in the response.

How do I add the post_poll function ?

相关标签:
1条回答
  • 2021-01-24 05:52

    Nice, so you're almost there! CLI apps don't have pre_ and post_ poll methods. Instead, you put any manipulation after the response comes in.

    const listEvents = (z, bundle) => {
    console.log('listing events.. ');
    let client_id = bundle.inputData.client_id;
    const requestOpts = {
        url: `https://wccqa.on24.com/wcc/api/v2/client/${client_id}/event`  
    };
    
    return z.request(requestOpts)
            .then((response) => {
                return z.JSON.parse(response.content);
            })
            .then(data => {
                const events = data.events; // array of events
                return events.map(function(e){ // returns array of objects with `id` defined
                    e.id = e.event_id
                    return e
                }) 
            })
    };
    
    0 讨论(0)
提交回复
热议问题