Mailchimp api how to get member source - php

I need to find out which user added to list manual, or via api.
We are using v3 api of Mailchimp.
With members endpoint
POST /lists/{list_id}/members
We get info about members, but there is no way to get a source.
So how get members source parameter?

Don't know if this is still relevant, but might be helpful for others, so here's my findings:
If you have any platform passing this information back to MailChimp via the API into one of the merge fields, then that's the field to dig for in members.
The built-in source corresponds with the one you can see under the email address on the profile page of your list members. This is NOT passed through the API, so you can't export it that way, however, there is a lengthy workaround: You can create a segment for each of the Signup Sources either via the GUI from the tool or via the API (look for POST /lists/{list_id}/segments and then under Request body parameters it's options/conditions/condition type next to Segment Type there is a dropdown, there you can select Signup Source Segment - Signup Source), extract the segments into csv files, add the corresponding static Source (as per the segment criteria), and there, you have a lookup.
Below is the explanation to some of the fields. These are the ones we're using, and since it's not documented (see here, look for Signup Source further down the page), I got this chatting to their Customer Service team:
"Admin Add" > means contact was manually added using the "Add Contacts" > "Add a Contact" page in your list.
"API Generic" means that the contact was added by an API enabled form or by an API sync with a database.
"Embed form" means the contact was added using the embedded form code from your list. This can be found in the "Signup Forms" > "Embedded form code" section of your list.
"Hosted Signup Form" means the contact was added using the hosted signup form. This can be found in the "Signup Forms" > "Form Builder" section of your list.
"List Import" means contact was added via a list import.
"Unknown" means that we don't have a really clear understanding of how the contact was added to your list.
There are a lot more types, if you go online and chat to their team, they will be able to tell you more about any that may not be self-explanatory.
Hope this helpZ? :)

Related

Using Mailchimp API with Shopify

I am attempting to use the Mailchimp API to allow site visitors to subscribe to my newsletter. Currently, any signups with the default form action that Mailchimp provides sends an Opt-In email and opens a new email to say thanks for subscribing, which I want to avoid. Instead, if I use the API, I can set those options to false. The problem is that it doesn't look like Shopify allows PHP or Ruby in their shop code. I've been looking for weeks for a solution, but I'm at a loss.
Here is a turnaround for this:
1.- Create a Wufoo form with one only field: email address.
2.- Paste this Wufoo form at your Shopify store. We'd recommed pasting the JavaScript version.
It can look like this
3.- On your notifications tab at your Wufoo form, choose to Send notifications to Another Aplication. On the dropdown, choose MailChimp click on Add integration and follow steps. You will be sending all email addresses to your desired MailChimp list.
Tiny problem is that placeholders on Wufoo forms, don't disappear on click, so the user needs to go inside the field and delete all the placeholder. (This might be a good point because robots can't do this, and you make sure the user is really involved in the process of typig his/her email address.)

Associate docusign envelope to salesfoce

I'm initiating an envelope using the REST API. I was able to set a custom field on the envelope to the salesforce account Id and then once complete upload the final document and update fields.
My next problem is I have some custom tags. In the custom tag settings I've related them to salesforce fields and enabled write back. I can't seem to get these to update salesforce if the information in the document changes. Is there an internal field or value that I need to set for the envelope to associate it with sales force?
Do I understand correctly that you've already installed DocuSign for Salesforce in your Salesforce org and have configured it to point to your DocuSign account? If so, you likely just need to update the "(Salesforce) Connect" configuration in DocuSign to explicitly tell it to write back the fields. I don't believe "merge fields" will write back data to Salesforce for envelopes that are initiated via the API.
This guide contains info about updating Connect settings for the DocuSign for Salesforce Connect configuration: http://www.docusign.com/sites/default/files/DocuSign%20Connect%20for%20Salesforce.pdf. Specifically, content relevant to your scenario starts on page 4 under heading "DocuSign Connect for Salesforce Settings -- and especially within item #7. To edit, add, delete, or change the order of Connect Objects that begins on page 6.
Within the "Salesforce" Connect Configuration in DocuSign, you can add a new "Connect Object" to have DocuSign automatically update a specific type of object in Salesforce based upon criteria you specify. For example, let's assume that you want to automatically update a Contact record in Salesforce (using data from DocuSign fields in a completed envelope) whenever a completed envelope contains a DocuSign secure field called HCP_ID, and the value in the HCP_ID DocuSign field matches the HCP_ID field value on a Contact record in Salesforce. Creating a Connect Object like the following would accomplish this:
The field mappings in the "Update Fields" section specify which values in Salesforce you want to update with which DocuSign values. (See the guide I've linked to above for more information -- it explains things in much greater detail than I've done here.)

Salesforce REST Api missing fields with PHP

I'm using the Salesforce REST API and found it very hard to find decent documentation.
I can successfully log in with OAuth and i can push new accounts to Salesforce.
I use the instance url to make the API calls and i send the following fields to create an account object:
Name
Rating
Description
The problem is that I created a free trial (which sits on na9.salesforce.com) and everything worked fine.
I created a second free trial to check if everything works with another account, but the rating field is not available... I get the following message from Salesforce:
"[{"message":"No such column 'rating' on sobject of Account"}]"
Why is that?
Also, is it possible to add notes to a created account using POST? And is it possible to create Leads instead of Accounts using the API?
Thanks in advance,
A feature called field level security (FLS) can mean that even standard fields are not accessible, check the FLS settings on account in your second org.
Docs for the REST API are on the developer force site

monkey with rental cars - integration into third party websites,

So,
I run a rental car company, and I want to integrate my service into a third party website - where people will be able to rent cars directly on the third party website. How can I integrate my service on the third party website efficiently? I am thinking that an iframe might be the best way or some sort of javascript call ... but I need the best way to integrate my service so that the third party site has to do less coding as possible.
I want people to check a box on the third party website if they want to rent a car and then a form pops up asking the customer for their payment details, then that information gets sent to my site, and my site processes that information and confirms the payment.
So basically, I was envisioning,
Person clicks a checkbox on third party site
Third party site sends information about the person to my site
I use that information to send back a payment box with price details
Person submits payment information on third party site
My site gets the payment information and processes the information
My site sends back status response to third party site.
The problem is, if the customer is a repeat customer, I would like the third party site to send me identifying information about the customer that will allow me to discern that she is a repeat- and thus charge her without her having to put her credit card details in the payment box.
In cases like this, its a lot more affordable, and sometimes more efficient to build a white label version of your product thats hosted on the same service as your primary product. This way all the functionality is essentially the same, except your slapping someone else's name on it and saying its powered by your company somewhere.
One key reason I suggest this is site to site transactions leave a lot of moving parts that can be tripped up through malicious means.
Take paypal for example, when ever you pay by paypal, what happens? You click the paypal button on the third party site, and it redirects you to the paypal site itself. You can do similar, you tell your 3rd party to submit a form like they would on any other site, and that posted data what little there will be as you want it all confirmable on your side so it leaves the door a little more closed to prevent someone from just changing the price or something. Anyway you take that posted data run it through your filters, compare it to whatever offers your allowing your 3rd party to do, and then process it all on your side. then when all is complete, you turn around and redirect back to there site and a thank you page.
Just food for thought
If you are going to implement a security so a hacker can't bog down your database with false orders use a shared secret key with which you encrypt the posted data to a hash, and then compare it on your side.
For example
$data = "color=blue|type=mazda|days=3|clientID=john#doe.com|etc=somedata";
$secretkey = "213098snxlkds_ljlsk3545";
$hash = hash('sha256',$data.$secretkey);
echo '<form target="someiframe" target="http://www.domain.com/bla/die/bla">
<input type="hidden" value="'.$data.'" name="data">
<input type="hidden" value="'.$hash.'" name="hash">
<input type="submit" value="Order the car Now!">';
Then at your side where you recieve the data you use this code
$secretkey = "213098snxlkds_ljlsk3545";
if(hash('sha256',$_POST['data'].$secretkey) === $_POST['hash'])
{
$process = explode('|',$_POST['data']);
foreach($process as $piece)
{
$vars = explode('=',$piece);
$Data[$vars[0]] = $vars[1];
}
}
This way if only you and your retailer have the hash, you can always verify that the retailer is legit and not some cheapchate trying to bog you down.
Having your service on third party sites means those sites are going to have to communicate with your app/site. On top of that, you want the users to be able to pay on the third party sites too, so you will be sending sensitive data back and forth. For that reason, I suggest you first get/integrate SSL.
Once you have that, you need to setup your own API. I know it probably sounds like a huge task, but it's actually not if you don't require much data and validation (returning loads of error codes and stuff).
So a quick example:
Let's say I have a website that people can login/register to. But I want users to be able to register to my site, on a third party site (like you want users to purchase goods from yours).
What I do here, is:
Create a basic script that will listen for any requests that third party sites will call. We shall call this one api.php:
//so we listen for POST params to be sent. These params will have users details stored in them
//so first check if all required params were sent:
if ( !isset($_POST['firstName']) || !isset($_POST['lastName']) || !isset($_POST['email']) )
{
exit();//because some/all of the required data is missing, we're going to stop right here xD
}//end of required data missing
//so if we get to this point, we know that the correct params have arrived
//so now you can do your registration stuff
//validate data (check if email is correct, if its been used before, ect ect)
//throw the data in the DB
//and if you need to, return some JSON status code
echo json_encode(array('status'=>'OK'));
That right there is an API. Very basic but still an API. So now you just tell the third party sites to post their info to "https://yousite.com/api.php" and it will return a status code, and the registration is completed.
I know that's not a very good example, but I hope you have managed to get the point.
Actually, most websites do this anyway. Even without the use of third party sites. When users register to a website, their data gets posted to some page. So I guess you could just POST data to your original signup/purchase/login page..
There are many different ways that you could approach this, but I think the simplest might be to have a simple JavaScript API that the third-party integrator can use on their website. Your JavaScript can set up the checkbox (for instance, attached to a div or form that the integrator specifies) and rig it so that when the user checks the box it opens a popup pointed at your site. You can then process your transaction from within the `popup.
This would be fairly comparable to how a basic Paypal integration works, where a user throws a Paypal button onto their site, and then when the button is clicked it opens a new window that points directly to Paypal's site (because as a general rule they cannot collect/accept payment or identity information directly from the third-party website) and passes a handful of parameters describing the transaction (payment amount, recipient, item details, etc.).
So for instance, a third-party might integrate with your service by first including your JavaScript file, like:
<script type="text/javascript" src="http://carmonkey.com/api/v1/MonkeyCar.js" />
...and then they might add some boilerplate code to hook up the API to the desired portion of their site:
<script type="text/javascript">
var options = {"container": "#someDivId", "userFirstName": "John",
"userLastName": "Smith", "rentalDate":"8/8/12", "duration":"7"};
MonkeyCar.drive(options);
</script>
Then your script needs to take those options and use them to add your checkbox to the target container element, and to configure the checkbox so that when the user click it a popup window opens to the appropriate URL on your website. So you might add something like:
<input type="checkbox" name="_monkeyCar" value="true"
onchange="if (this.checked) {MonkeyCar.open('http://carmonkey.com/reserve?fname=John&lname=smith&...');}" />
Book a Rental Car
Then once that happens the user can complete their rental car booking as normal, since the popup is just running a normal browser session with your standard website.
If you wanted to get fancy you could also add-in a feedback loop so that the JavaScript API running on the third-party page can get updates about the transaction status and detect when a transaction completes/is canceled and update the hosting page with the status.

mailchimp php integration

I am trying to find a simple bare bones example/demo that shows me how I can build a trivial/proof of concept website that will collect user email (and maybe first name), and add this name to a list created on mailchimp.
To clarify, I am not merely asking how to create a PHP/mySQl website - I already know how to do that, and I already know how to place a form on a page etc.
Assuming I already have the following:
- A php/MySQL site with a registration form
- A newly created list on mailchimp
More specifically, I want a user to be able to register on a page on my site, and then I want the following sequence of events to happen:
When a user clicks the 'submit' button on my page, their details gets sent to mailchimp and added to a specific list created on mailchimp
They are sent a confirmation email by mailchimp
Once they confirm subscription, they are directed back to a page on my site, with a token from mailchimp
I store their details (provided by mailchimp) into my MySQL database
I send the confirmed subscriber an email with an attachment
When the user unsubscribes from the list, I get notified by mailchimp and I can flag the user as unsubscribed in my database.
I have not been able to find a simple demo (or tutorial) that shows how to implement the required functionality listed above. Can anyone recommend a link (or links) to get me started with implementing these specific "bare bone" functionality?
The documentation is rather good I thought?
Just checkout the API-docs: http://apidocs.mailchimp.com/api/how-to/basic-subscribe.php
And if for some reason you do not want to read docs but just want to see code (please, don't do this, but hey, what do I know): click on the exmples listed here: http://apidocs.mailchimp.com/api/downloads/#examples
Start with the example code and if it doesn't do exactly everything, you can find it at the docs easily enough.

Categories