How can I unarchive a member using the Mailchimp API? - mailchimp-api-v3.0

I'm working with the Mailchimp API v3.0 to mutate list members.
Archiving members works without issues using the following endpoint:
DELETE /lists/{list_id}/members/{subscriber_hash}
The web-interface allows me to "unarchive" a member, reverting it back to it's previous state.
I haven't found this functionality in the API documentation yet.
I was able to unarchive the member by using the endpoint:
PATCH /lists/{list_id}/members/{subscriber_hash}
with body:
{"status": "subscribed"}
Although this does unarchive the member, this doesn't restore the status of the member. It simply sets the status to "subscribed" as provided in the body.
I'd like restore a member to its status before archiving. If a member was subscribed before archiving, then I would like it to be subscribed after unarchiving. Similarly if a member was unsubscribed before archiving, then they should be unsubscribed after unarchiving. Similar to what the web-interface does.
When retrieving the data of an archived member the return data does not include the status before archiving.
How can I unarchive a member using the Mailchimp API? Am I overlooking something, or is this functionality missing from the API?

I've had contact with the Mailchimp support team and currently have a band aid solution.
Let me first add some additional info that is not provided in the documentation (this comes from my chat session with the support team):
Overall from what I'm seeing, there does not appear to be a specific method to unarchive contacts without altering their original status. However while contacts who unsubscribed on their own will not be affected by the status change, other contacts who were manually unsubscribed (by you or someone else through the account/api) they will have that updated since that is considered a type of admin action.
With the above info my current solution is to update a list member to status "subscribed". If this fails with an 400 error I assume that the member unsubscribed at their own and send another request, this time using status "unsubscribed".
So:
PATCH /lists/{list_id}/members/{subscriber_hash}
{"status": "subscribed"}
If above results in status 400 then:
PATCH /lists/{list_id}/members/{subscriber_hash}
{"status": "unsubscribed"}
This solution still leaves a lot to be desired. This effectively means you cannot unarchive list members that you've given the status "unarchived" yourself. You also have to make 2 requests for list members that unsubscribed.
I've send a feedback email suggesting to add the resource:
POST /lists/{list_id}/members/{subscriber_hash}/actions/unarchive
Which is consistent with their permanent delete list member resource.

Related

How to create a WorkItem in Azure DevOps based off new email in Shared Inbox, but replies to emails stay within same task

I'm currently trying to set up a workflow within Microsoft Power Automate to do the following:
If an email is sent to a shared email box create a new task in DevOps
If someone replies back to that initial email - any responses to that thread will be tracked in the original task, and no additional tasks will be created from that chain.
Right now I'm leveraging the template that Microsoft provides called "Create a workitem in Azure DevOps when new email arrives in shared mailbox", but it creates additional tasks anytime someone replies back to the thread.
Anyone have suggestions?
Thanks,
You could use a condition that checks the 'Conversation Id' then if it matches an Id from a previously sent email's Conversation Id it does nothing. If it is new, then you'll get a new task.
If you are archiving handled emails, you'll need to filter results from the archival folder.
Here it is mapped out with a SharePoint list mapping the Conversation Id from each email:
Once the details are logged, the Get Items action on the SharePoint list pulls all items. However in that pull it uses an ODATA Filter on:
conversationId eq '<Conversation Id from trigger>'
Then if the number of matches is more than the one that you've just registered in the list, that means it was a response and the flow will follow the "no" branch. However, if it is the only entry, a new work item can be made.
You can make this much more complicated, dependent on requirements, in many areas, as that why you are using Power Automate. For example you could make API (Graph) calls to get Shared Box emails, but this is simpler, and works on a free flow plan until they add a "Get Emails from a Shared Mailbox" connector.
It's not picture perfect, because it doesn't handle a changed subject line, but it does do the job required.

Is it possible to update a group's auto-reply settings using the API?

I'm using Gmail.Users.Settings.updateVacation to update our customer service rep's vacation responses automatically over the weekend and after-hours, so our customers who e-mail when we're not in the office get an informative message of when they can expect a response.
I am attempting to do the same thing with our Google Groups, but have not been able to find the correct API call. If I use the same method as above, but with a group's e-mail address, I get a "Delegation denied" error (even though I'm an Owner of the group). I suspect this is because a Group is not a User, and is just different.
I've found the Manage Group Settings API, which essentially has just one update method, and you use properties to specify what you want to update on the group. The problem is, there is no auto-reply property name that I can find.
How do I update a Group's auto-reply settings?
Many thanks!
Unfortunately, what you want cannot be achieved through the API.
All the possible methods are present in the Groups Settings API so if you didn't find the expected method there, then it means that is not possible through the API.
What you can do instead is to file a Feature Request here and provide all the necessary details.
Reference
Groups Settings API - Groups Resource.

Microsoft Graph List Contacts API returns contacts beyond what are visible in the Outlook UI

Outlook UI
You can see that I've made three test contacts in the UI accessible here: https://outlook.live.com/people/
Microsoft Graph List Contacts API
When I call the List Contacts API (https://graph.microsoft.com/beta/me/contacts?$orderby=createdDateTime desc&$top=50), I get a list of contacts that is much more extensive than the list visible in the UI. These contacts appear to be anyone that has emailed me or anyone that I've emailed.
The problem
If I want to poll against the GET /me/contacts endpoint to get some data whenever I make a new contact, I'll end up getting notified every time someone new sends me an email or every time I send someone new an email (even if I didn't manually create the contact).
Is this intentional? If so, are there any filters I could add to specify that I don't want to get contacts that were not manually created by me? Looking over the JSON representation of a contact, I don't see anything I can filter on.
Possible Solution
My only thought is that I notice that the contacts made for me exist in a folder that is not returned in the contactFolders API endpoint. I could theoretically make a call to that endpoint and take the list of contacts returned and check if the parentFolderId exists in there. If it does, presumably that's because we created a contact and if not then it's made for us. That feels terribly hacky, though.
Thanks for the help!
This is an issue with the Microsoft Graph Beta APIs. Switching to the v1.0 of the Graph REST APIs resolved this.
It seems Outlook automatically adds every email address that had been in contact with the user as a hidden contact in a hidden folder.
The GET beta/me/contacts endpoint (unlike the v1.0 one) returns all contacts from all folders, so it also includes this hidden folder.
There are two ways to get the expected list of contacts:
Option 1 - get all contacts, and then filter:
GET /beta/me/contactFolders to obtain a list of "real" folders (this endpoint does not return that hidden folder)
GET /beta/me/contacts to get all contacts in the account
Filter the list of contacts by field parentFolderId - to keep only contacts in one of the folders returned at step 1
Option 2 - get contacts by folder:
GET /beta/me/contactFolders to obtain a list of "real" folders (this endpoint does not return that hidden folder)
for each folder returned call GET /beta/me/contactFolders/{folder-id}/contacts and aggregate the returned contact lists
Hope this helps.

Mailchimp - API equivalent to Lists Webhook

We can't setup a Webhook for security reasons so we would like to make a request to the Mailchimp API to get the same information that is contained in the Lists webhook (subscribes, unsubscribes, updates etc) and perform this daily.
I've been looking at the Mailchimp API docs and under the Lists section I can't see anything that would allow us to do a GET for all "list activities" similar to what is contained in the Lists webhook.
Does anyone know if it's possible to get the same information via the Mailchimp API that is contained in the Lists webhook?
I found this endpoint:
http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/#
which you can call using the Query String parameter:
since_last_changed - Restrict results to subscribers whose information changed after the set timeframe
So far this is the closest that I have found.

Mailchimp API send call returns Campaign_EgpPrediction error

I'm using MailChimp v2.0 API at the moment to replicate, update and then send mail campaigns. All so far so good, but occasionally I'm getting this curious error when I call campaigns/send
{
"status": "error",
"code": -99,
"name": "Campaign_EgpPrediction_Exception",
"error": "Campaign_EgpPrediction"
}
If I try again, it may work. Seems sporadic.
Workflow: I replicate one of our standard campaigns then get the new ID, then with this ID I update the title, make it a URL-driven campaign by updating the url value, move it to a folder, then send it.
All the other API calls are successful, just the send sometimes says that.
I can't find reference to the error anywhere in MailChimp docs, I have asked their API support team but whilst I'm waiting...
This is caused by a predicted bounce rate warning. After I went ahead and sent the campaign despite the warning (which doesn't exist in MailChimp's documentation) I got the following from the compliance team shortly afterwards:
This is a note from the MailChimp compliance team. Omnivore, our automated abuse prevention system, detected a recent campaign that generated a bounce rate which exceeded allowable industry thresholds. Noting the account received an above threshold bounce rate, Omnivore has detected that this list requires removal from our system before we would be able to reactivate the account.
As a bulk delivery service we are required to enforce the industry thresholds that ISPs, anti-spam groups and corporate email protection services set regarding spam complaints, bounces and unsubscribe requests. When rates exceed industry thresholds, as your campaign did, Internet Service Providers can block service to the entire MailChimp ecosystem.
Keeping this in mind, the list must be removed from the account before we are able to support further sending. Because a list cannot be deleted for 7 days following a campaign send, we do ask that these contacts be bulk unsubscribed from the list following the instructions provided
So, it looks like the system will warn you with this error message via then API and then let's you send it anyway if you persist!
I hope this helps someone else in the future from sending to a list that may cause you larger problems later.

Resources