Unsubscribe Reason Not Working in Mailchimp when using MailChimp.Net Library - asp.net

I am using mailchimp.net library (https://github.com/brandonseydel/MailChimp.Net) to use mailchimp api. And everything is working fine except that the unsubscribe reason does not work when i update the member.
for example:
Under certain event i am using following code to unsubscribe:
existingMember.Status = Status.Unsubscribed;
existingMember.UnsubscribeReason = "Contact Unsubscribed from contact page" ;
//***Notice the Unsubscribe Reason here, i have different pages which has different unsubscribe reason***
await _mailChimpManager.Members.AddOrUpdateAsync(listUserSubscribed, existingMember)
.ConfigureAwait(false);
Now, Next i created webhook in mailchimp as explained here (https://mailchimp.com/developer/marketing/guides/sync-audience-data-webhooks/#create-a-new-webhook). However the unsubscribe reason is always "manual" and it doesnt shows the note that i entered earlier (i.e. Contact Unsubscribed from contact page) .
Is there anything i am missing? or is there any other way to achieve the same?
Thanks in advance !!!

Related

Refresh checkout in woocommerce_after_checkout_validation

A client is asking to allow users to register during checkout. The problem is there are some logic about memberships so registering can alter the final price and I can't use the standard Woocommerce way.
So i wrote a couple of validations. First i check if everything is in order, if it is a second validation actually creates the customer account, set all meta fields, login the customer.
Now what I need is to fully realod the checkout page and output a notice telling the customer to press the checkout button again.
I'm using woocommerce_after_checkout_validation but I can't make it work.
I tried a wp_redirect and outputting an ugly in the error notice.
Any ideas on how to do this?
I ended up using Javascript hooks to fire an event after the validation. The error checking is pretty bad, in my case it works but it should be more general.
var error_text = jQuery(".woocommerce-error").find("li").first().text();
if (
error_text.trim() ==
"register_success"
) {
window.setTimeout(function () {
location.reload();
}, 1500);
}
});

Puppeteer - Click button behind a notification

Puppeteer 2.1.0
jest-puppeteer 4.4.0
Win 10 64bit
I have this situation https://i.imgur.com/JbcQAhB.png
I want to click the green button but the notification is in my way.
My code:
selector = "//main/div[1]/div[2]/button[1]"
await page.waitForXPath(selector)
const elementHandle = await page.$x(selector)
await elementHandle[0].click()
This code won't click the button, and I know is the notification, because if before the click() I put a waitFor(5000) and close the notification manually then it works just fine
I also tried in the chrome console directly like this, and it works just fine with the notification in front
$x("//main/div[1]/div[2]/button[1]")[0].click()
Also this kind of code should work for headless mode, so the fact that the notification is "In front" should never be an issue.
Possible questions:
Are you using headed mode? Yes, I have to. I'm testing using chrome extensions.
Using Xpath instead of selectors? Yes, I have no option as well, I have to use xpath
Why no closing the notification? It could work (and actually it does for this particular situation), but that's not the only notification that popUps, more of those show up and messes up with other similar buttons. I need to click the button behind the notification
Thanks!
I found a way, I just changed the await elementHandle[0].click() for await page.evaluate(x=>x.click() , elementHandle[0])
I'll leave the question here, hope somebody find it useful

FirebaseUI for Web — Auth - how to re-authenticate?

I'm using FirebaseUI for Web — Auth widget to simplify the auth workflow, and I'm stuck with a problem. Everything works OK the first time. But, after I sign in, the widget contents clears away, and the 'Sign in with ...' buttons never come back. Trying to recreate the widget brings up the error "UI Widget is already initialized on the page. Only one widget instance can be initialized per page."
This means that users need to refresh the page to get the sign-in buttons back. Is there a more elegant way?
Are you rendering the widget in a single page application? If so, this currently won't work. You will have to render the sign in widget in a popup whenever you want the user to sign in.
As bojeil stated in the first answer (May 2016), there was really a problem using it in single page applications workflows. But in more recent versions of firebase-ui you can actually reset the widget so you won't need to initialize it again.
All you need to do is to keep the widgets instance reference in a variable. Then, when you want to render it again you use the same reference, reset it and then restart it.
var ui;
if (ui) {
ui.reset();
} else {
ui = new firebaseui.auth.AuthUI(firebase.auth());
}
ui.start('#firebaseui-auth-container', uiConfig);

PayPal in-context bolt-on opens blank popup

Having integrated PayPal Express for one of our clients (in ASPX WebForms) and received some under-documented integration steps (https://developer.paypal.com/docs/classic/express-checkout/in-context/integration/) for bolting on the so-called in-context integration, we're facing the following issues:
1) The document asks for the Merchant ID, which, for a sandbox can't be found, wondering if it's the same as the Username in the API credentials
2) I've set up an aspx page for the express checkout to do the posts and gets, which only requires the order id (this would be /checkout_paypal_nvp.aspx?oid={OrderID} below). Judging by the example code PP provided, we're guessing this is what needs to be passed in, but on clicking the 'Check out with PayPal' button, there's only an about:blank popup appearing, and the page doesn't get executed.
Also wondering if 2) is caused by using the wrong Merchant ID in 1), hence the double question (sorry).
Screenshot for ease of visualisation:
Relevant code:
<a id="lnkPaypalCheckout" href="/checkout_paypal_nvp.aspx?oid=81774"></a>
<script>
window.paypalCheckoutReady = function () {
paypal.checkout.setup('{API_username_here}', {
container: 'lnkPaypalCheckout',
locale: 'en_GB',
environment: 'sandbox'
});
};
</script>
<script src="//www.paypalobjects.com/api/checkout.js" async></script>
Many thanks in advance.
Answers to your issues:
The merchant ID (you can found under My Account > Profile > My business info > Merchant account ID) can be used for both production and sandbox environments.
Please make sure "/checkout_paypal_nvp.aspx?oid=81774” returns with the correct PayPal flow url. If you comment out the two script sections which for in-context setup, you should see the PayPal flow being loaded in the full page. That will be your first step before adding in-context setup.

Notify a facebook user if a comment is made using the <fb:Comments> comment box

I have an application on facebook and i have the facebook comment box on it. If someone makes a comment using the comment box, is there a way to notify person that a post has been made on their app
I have the following code
<script src="https://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:comments xid="test" canpost="true" candelete="false" href="<%= link %>" num_posts="10" width="500" send_notification_uid="<%= fbUserId %>" notify="true" publish_feed="true"></fb:comments>
The href - link is a dynamic link depending on where the post was made. The send_notification_uid - user_Id is also dynamic and it retrieves the user id of the person that owns the page.
Any help would be great. It all works apart from the send notification
I believe using the javascript SDK you can subscribe to the comment.create event. Then provided you have the necessary permissions for the uid in question, you could then send them a notification I believe. I haven't tested this but you need to look at the FB.event.subscribe code
https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/
There's some more information on a post here
http://facebook.stackoverflow.com/questions/6146925/fb-event-subscribecomment-create-doesnt-work
Further to this you can test things out on the js skd tool
https://developers.facebook.com/tools/console/
and some sample code
<h1>Defaults</h1>
<fb:comments href="http://www.fbrell.com/"></fb:comments>
<script>
FB.Event.subscribe('comments.add', function(resp) {
console.log('Comment was added' + resp);
});
</script>
I don't know if the specs changed, but the current answer doesn't work anymore, the new way is now this :
FB.Event.subscribe('comment.create', function() {
console.log('Comment was added');
console.log(arguments);
});
comment.create , as explained here : https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/v2.0#comments-example

Resources