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

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.

Related

How to search for a message by a specific ts

I am trying to get the parent message of a threaded reply with the Slack API. When a new reply is put, it has a "thread_ts" attached to it, which corrsponds to its parent message's "ts". I tried to do a searchall with the ts as the query but this didn't work. How would I do this?
See Slack's docs on retrieving a single message with channels.history. This "selecting 1 item from a range" approach should also work with other channel history methods and conversations.history.
The easiest way is to provide the thread_ts value you want to look up as the latest parameter to conversations.history, along with the containing channel ID as channel, and a limit of 1 to ask for a single message. You will need the corresponding *:history scope to make the request.
Example:
GET /api/conversations.history?token=TOKEN_WITH_CHANNELS_HISTORY_SCOPE&channel=C2EB2QT8A&latest=1476909142.000007&inclusive=true&limit=1

Loop through Zapier webhook result

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.

What is the purpose of each parameter in a MailChimp unsubscribe URL?

In the following URL, that unsubscribes a user from a list:
http://xxxxx.us2.list-manage.com/unsubscribe?
u=87f537bccxx35e53a1890e0d9&
id=40dcxx6cd6&
e=c4aaxx1dd6&
c=9a6xx11963
What does each parameter do?
Today I had to learn what each nondescript parameter means so that I could generate URLs for each email I send through Mandrill. It wasn't that easy to discover their meaning, but here are the one's I've come up with and how I found out what they are.
http://xxxxx.us2.list-manage.com/unsubscribe?
u=87f537bccxx35e53a1890e0d9&
id=40dcxx6cd6&
e=c4aaxx1dd6&
c=9a6xx11963
URL format:
Protocol can be http or https.
Your username comes next
In the example, us2 is the MailChimp datacenter where your account resides. That's different for each account. (https://apidocs.mailchimp.com/api/2.0/) It's good practice to specify a DC even though the documentation says that it isn't required. Specifying it will cut down on unnecessary latency.
list-manage[n].com can work with or without the number at the end of the domain, or it can have a 1 or a 2. Changing that doesn't appear to matter, but I think it has something to do with their load balancing.
/unsubscribe can also be /subscribe or /profile (The latter appears to be dependent on the "e" parameter. (See below) When you don't specify it, it states, "List member profiles cannot be updated from test campaigns or archive pages" and if you specify an invalid value, you get an error page.
u Is a unique identifier for your account. Every list on your account uses it. (See http://kb.mailchimp.com/lists/signup-forms/find-the-unsubscribe-link-for-your-list for how you can view the various URLs for your account.)
id is your list ID
e is the euid as documented on https://apidocs.mailchimp.com/api/2.0/lists/subscribe.php
c I haven't seen this one yet, but my guess is that it's the campaign ID.
Also, when you wish to prefill subscribe and unsubscribe forms, you can use the following GET params.
EMAIL Allows you to enter the subscriber's email
MERGE1 Allows you to enter the subscriber's first name
MERGE2 Allows you to enter the subscriber's last name

Twilio REST API: request messages after sid

Problem
Using the Twilio REST API, I want to request only messages that I haven't downloaded yet. It seems the cleanest way to do this would be to download only messages after a specified SID.
Information not in the docs
The Twilio filter docs don't have this option. They only describe to, from, and date_sent.
However, it appears that Twilio does have this feature. You can see in their paging information, that the the nextpageuri contains AfterSid.
When browing the website, the URL contains /user/account/log/messages?after=SMXXXXXX
What I've tried so far
Using the twilio-ruby client, I have tried the following without success:
list = #client.account.sms.messages.list({after: 'SMXXXXXX'})
list = #client.account.sms.messages.list({AfterSid: 'SMXXXXXX'})
list = #client.account.sms.messages.list({after_sid: 'SMXXXXXX'})
From Dan Markiewicz - Twilio Customer Support
Unfortunately, we do not support filtering by this field in our API at this time. Your best option would be to get the DateCreated info on the SID you want to filter by and then use that to filter the messages by only those sent after that date. Since the date filter only supports filtering down to the day, it may return some number of unwanted messages that were sent that day but before the message you want to filter by. However, each message in the list will have a full date_created field down to the second, so you should be able to filter these out fairly easily on your end. This should produce the result you need.
After looking at the documentation you outlined, it looks like what you want to accomplish can't be done by the twilio-ruby gem. This link shows which filters are supported by the list method inside the gem in regards to messages.
If you look at the source here, starting on line 45 the gem uses next_page_uri as a way of determining the offset of where the next page should begin. For instance:
calls = twilio_client.account.calls.list # returns the initial set of calls.
calls.next_page # this uses next_page_uri to return the next set of calls internally.
This isn't something that can be changed via the gem currently.

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