In MailChimp, how would use a merge tag to check whether someone's using Gmail? - conditional-statements

Using merge tags in MailChimp, how would I go about detecting whether the recipient is using Gmail, and display a message in the header accordingly?
As an example, here's what I've got in my header now, which fires if a certain email address is encountered (as opposed to if gmail.com is seen in the email domain):
*|IF:EMAIL=someone#gmail.com|*
Using Gmail? Drag this message to your Primary tab.
*|END:IF|*
Knowing that MailChimp merge tags also supports the following:
*|IF:EMAIL != someone#gmail.com|*
You are not someone#gmail.com ...you must be someone else.
*|END:IF|*
Is it possible to show a message in the header only when the recipient is a Gmail user? What operator would I use? Clearly it's not = and it's not !=

MailChimp doesn't support partial match functionality in their api. Your best hope is to process your list as subsets of the master, with domain specific functionality wired into each set.

What I've started doing is set up a saved, auto updating segment and then export it, remove everything except email column, and import it (auto updating the list) into an interest group. You can then use the interest group within conditional merge tags (whereas you can't use a segment for that, segments are only for an email send).

Related

Adding recipient Groups to a CiviCRM Mailing via REST.. how?

I have been able so far to create a new civi Mailing object and populate it, but confusingly I can't see a parameter in that to specify the mail destination group.
For context, I am dealing with Civi using pure REST api from a remote server. I have a solution to getting a custom template onto the server; the new problem is setting a schedule and delivery group, and initiating the send. I am using the python-civicrm library from github as the intermediary on the client.
I presume send happens as a result of setting the schedule -- i.e. I don't need an API call to say 'send mailing'? Is setting 'sheduled date' == 'now' safe or should I set a date of 'now + 1min' or similar?
So that leaves setting the delivery group. We already have groups defined in the DB, and I want to specify the group by name (and preferably be able to verify in advance that a group name is a valid destination, perhaps by doing a group name -> id lookup).
I think there might be a parameter to Mailing create 'groups' which can have keys 'include' and 'exclude'; at least, that's what the web form seems to do. However it's not mentioned in the REST api implementation.
Can anyone offer pointers?
I think you will find all you need in the following link :
Example of api call that is using the group include/exclude : https://gist.github.com/xurizaemon/6775471
Discussion about implementing mailing as an api - http://forum.civicrm.org/index.php?topic=24075.0
Otherwise, if it doesn't work, i suggest that you :
help adding this api in the CiviCRM Core - you could have some help on this on irc #civicrm (and have a look at https://issues.civicrm.org/jira/browse/CRM-11023)
OR create an extension with the api you need. It will be automatically available for REST. If you haven't created an extension yet, i suggest you go to the page http://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Module+Extension. It's quite straightforward with civix installed.
The table you need to check in the database is civicrm_mailing_group
To confirm, the problem was that (a) I needed to use groups[include]=array(ids) as mentioned by samuelsov, but also (b) I needed to use the json={...} form of request through REST, because the HTTP params syntax doesn't support nested data.

Is it possible to deliver more than one pass in a .PKPASS file?

use case:
A customer bought a flight for his family.
Now he wants to download all boarding passes for his flight at once and store it in passbook.
How can I solve this problem?
Can I add more than one pass descriptions in a pass.json?
Or is it possible to reference more than one pass.json files in the manifest.json?
Short answer is No. You cannot include more than one pass in the pass.json or add a reference that will be recognised by Passbook.
Long answer is that there are a number of things that you could do to make it easier for the user. These include:
Send all the passes in a single confirmation email as attachments
Include links on the back of the passes to the other passes in the same booking
Include a single link on all passes and in any confirmation mesage / email to a page with links where each pass can be downloaded
Deliver the passes via an app
The last option would provide you access to PKAddPassesViewController class, which if used with the addPasses:withCompletionHandler: of the PKPassLibrary class, would allow for multiple passes to be added.

Need help understanding REST API endpoints

I don't quite grok how to sensibly structure a REST (or REST-like) API.
Imagine an API for creating and sending out newsletter emails. You might have the following nouns/resources: newsletters (subject, body, etc.), mailing lists (collections of recipients), and recipients (email addresses and associated data).
So you could use PUT to create a resource and be returned its ID:
/newsletter
/list
/user
You could obtain information on a resource using GET:
/newsletter/[id]
/list/[id]
/user/[id]
You can update an existing resource using PATCH (or should this be POST?):
/newsletter/[id]
/list/[id]
/user/[id]
You can delete a resource using DELETE:
/newsletter/[id]
/list/[id]
/user/[id]
Is the above correct?
What endpoints are sensible for actions like sending a newsletter to a list, adding a user to a list?
Does the following make sense, and is it RESTfull?
/newsletter/[newsletter_id]/send/[mailinglist_id]
/list/[list_id]/add/[user_id]
/list/[list_id]/remove/[user_id]
Is it redundant or unhelpful to have list/[id]/add/[id] and list/[id]/remove/[id] endpoints for lists, when users could be added or removed via PATCH at /list/[id] ?
What about searching for a users' ID via a property like email address or name? Or getting a list via an identifier like its name or when it was created?
You pretty much nailed it, except with the /list/[list_id]/add/[user_id] and /list/[list_id]/remove[user_id], because you have verbs in the URL - that is the purpose of the HTTP methods. Change them to, for example:
PUT (or POST) to /list/[list_id]/users/ for adding a user to the list
and
DELETE to /list/[list_id]/users/[user_id]
For search, I'd go with parameterized url for the list of resources, like:
/newsletter/?name=dfjkhskdfh
These verbs are often confused:
To create an entity you use POST
To update - PUT
These things could be treated in the following way:
POST /newsletters/[newsletter_id]/mailinglists/[mailinglist_id]/mailingfacts - performs sending the letters, it's like adding a fact of mailing to the collection
/lists/[list_id]/[user_id] - adds a user to the list
/lists/[list_id]/[user_id] - deletes the user from the list.
Is it redundant or unhelpful to have list/[id]/add/[id] and list/[id]/remove/[id] endpoints for lists, when users could be added or removed via PATCH at /list/[id] ?
It is bad/unhelpful. One of the ideas of REST is that the end points are resources and not a Remote Procedure Call (RPC). add or remove is suggesting a procedure to call.
Further GET requests should be side-effect free, that is, they don't do any updates. Further Roy Fielding explains GET as:
retrieval of information that should be a representation of some resource
So GET is only for retrieval, not for sending data (i.e. which user to add/remove).
The other very dangerous problem with list/[id]/remove/[id] is that if a spider or your test framework is going around your site it could start deleting items.

Auto email response from Shopify api

I've successfully created a script that will import username/passwords etc into Shopify (using the api).
However, when I do this an automatic email is sent to the customer. I don't need this and can't find a way of either modifying it or turning it off. There is no mention of the email in the api documentation which has meant me finding out the hard way (by some clients complaining!)
The email is not the same one that is sent to the customer when a new account is set up. So where does it come from? How can I switch it off/modify it's contents?
Any ideas?
Well, after some digging I found where the email message was being generated from. It is one of the default messages that are already set up in Shopify (Customer Account confirmation) under 'Emails & Notifications'.
Just make sure you change this before you start running your shop as the default message is a little 'dry'.
Thanks for your help guys.

How to modify the default receiver list in system Mail app

I'm using Objective-C. I wonder is there any plug-ins or libraries that can allow me to modify the default receiver list in system Mail app?
For example, I have made an app which can scan a card and fetch the E-mail information on it.
Now, I'd like to put the E-mail data I've fetched into system Mail app's receiver list. That is, when I use the system Mail app and write a new mail, I can see the E-mail address I fetched when I type some letters in the receiver column.
Is that possible to achieve?
This list is stored as a Sqlite database and it should be possible to append to it from another process, even while Mail.app is running. I haven't tested it, though.
The following article should help. It describes how to delete entries but adding new ones would work in pretty much the same way: http://hints.macworld.com/article.php?story=20110516152604993