Loop through Zapier webhook result - zapier

Just trying to figure out if it is possible to loop through Zapier webhook result set and do something with it.
I have a zap that runs once a day and makes a GET request to a specific URL. There's a JSON result that comes back and now I would like to loop through this resultset and fetch emails from each record for using this email list when sending emails with Mailgun.
Any hints?

Yes, that's possible! Zapier can loop through actions up to 25 times. You just need to give it data in the right format (an array of JSON objects).
Here's the steps you'd have in your zap:
Scheduler trigger to run the zap each day
Your webhook GET request
Code step which takes your webhook result, and converts it into an array of JSON objects with email addresses in them
Do something for each email address. You can pick any zapier action, and it will run for every address.
Add any more actions that you want for every email address here...

I think the simpler approach is to use a "Code by Zapier" action and make the HTTP request directly in the code where you can process the response.
Some more info here.

Related

IFTTT webhook to google sheets

I am sending a request to a IFTTT webhook, which receives the request and saves it to a google sheets file.
There are a few predefined available fields that I can use to send to IFTTT, which in turn get passed forward to the google sheets file (Value1, Value2, Value3).
When sending the request to IFTTT, I can pass those fields in the JSON object I am sending, like this:
{
"value1": article.title,
"value2": article.summary,
"value3": article.text,
}
The problem arises if I wish to send another value. Imagine I want to add an "image" field. I can update the JSON to be sent to:
{
"value1": article.title,
"value2": article.summary,
"value3": article.text,
"image": article.image
}
but within IFTTT, if I try to add that field in the action to send it to google, I can save the applet (even though the field shows up in red) but nothing gets passed to the google sheets file in that field (the other 3 fields are still being sent).
Where and how can I add the extra field? Do I need to change something in the webhook, do something in the filter, or how can I pass other, custom fields?
Thank you.
This can't be done the way I was looking to do it.
You cannot add custom fields to the webhook.
What I ended up doing was sending all of the fields I needed inside VALUE1 as JSON, and forward that to another service to be processed.
Hell of a hack, but seems like an IFTTT limitation. In the meanwhile I have migrated to Zapier, and it's a whole different world!

how to figure out all messages with a specific groupId has been read from the queue in SQS?

Here is my requirement: I receive a request to validate some data/records. Records would be sent to the SQS queue per each request for further processing by another service/component. The message structure looks like this:
messageId: //a unique message id
requestId: //request id common between all messages/records for that request
record_body: {//key-value pairs}
Everything works fine. Now I want to figure out when all messages with the same request id have been read from the queue (I.e. there is no more message for that request id).
The idea that I have is to write each message/record to the database upon each read and then have another scheduled service that can be triggered (by cloudwatch) to check the number of records for each request and finally update the status of the request to complete if the number of records in the database are equal to the number of records in the original request.
I just want to share this to see if anybody else had this kind of requirement and how they approached it!
How about this ?
Include the number of requests and current request to the queue. Make sure the request goes to the queue in the same order.
Example - You have 4 requests for requestId - abc
You will send each request with values included (1:4) (2:4) (3:4) (4:4) in the order to the queue.
This way when you are reading from the queue you will read (4:4) last and you will know you have processed all the 4.
Another way to do is include total number of requests in the message in every message and while processing each message check whether it matches the original one as you have total in your message now. (by querying the database).

Get Email From Hunter.io user Zapier Code Step

I'm trying to use Zapier to call the Hunter.io API and return the first email. Since Zapier is pretty linear I need to be able to return individual emails. When I run this I get the following error "We had trouble sending your test through. Please try again. Error:
You must return a single object or array of objects." I realize I put my API key in there - its only linked to a free version so don't go wild :-).
Any help is appreciated.
fetch('https://api.hunter.io/v2/domain-search?domain=' + inputData.website + '&api_key=11b44ca200c3b3ac0b5cf08091bce3346acd2ed3')
  .then(function(res) {
    return res.json();
  })
  .then(function(json) {
    console.log(json);
    callback(null, json.emails);
  })
  .catch(callback);
David here, from the Zapier Platform team.
Luckily this is an easy fix - it looks like the json that comes back has top-level data and meta keys, the former of which has the emails, you're looking for. If you change your successful callback to
callback(null, json.data.emails)
you should be good to go. Note that subsequent steps will run for each email returned during each run of the zap and no deduplication happens. Make sure whatever's downstream of this can happen a lot without consequences!
Also you'll definitely want to regenerate your API Key once this is resolved. Definitely not something you want floating around. :)

Zapier - Zap, How to call an Action on a list one by one

I'm configuring a zap which does the following:
Get a list of emails from an API endpoint.
Subscribe each record to Mailchimp
My problem here is that the subscriber email takes in a list of emails and this returns the following error message:
Bargle. We hit an error creating a subscriber. :-( Error: Invalid
Resource - Please provide a valid email address.
This is because Mailchimp aparently doesn't allow multple subscriptions in one single form.
So my question is, is there a way to perform an action per element in the list ?
Some sort of
emailList.foreach(function(email){
performAction(email);
})
Note that I cannot use the cli, is this possible with some sort of funnel action in zapier or maybe using the scrpting ?
Thanks
David here, from the Zapier Platform team.
By default, when a trigger returns a top-level list of objects, subsequent actions occur for each. I'm not sure what type of trigger you're working with, but make sure it returns an object like this:
return [{email: 'email1#gmail.com'}, {email: 'email2#gmail.com'}, {email: 'email3#gmail.com'}]
and it should work as expected.

verifying a single attendee with email

Is there a method to return a specific attendee's information by sending:
1) the attendee's email address
2) my user_key
3) my app_key
I could do this by searching the returned xml from this "event_list_attendees" method, however, I would prefer to only receive the one result (not hundreds for each call).
Note: I work on the platform team at Eventbrite
Currently there is no way to search for a specific attendee with event_list_attendees.
However, you can cut down on the amount of data returned by paging through the results until you have found the attendee or using the modified_after parameter if you know when the user was last updated: http://developer.eventbrite.com/doc/events/event_list_attendees/
I realize this limitation is non-ideal. We're actively working on building a new API which is more RESTful and does not have issues like this.

Resources