-2

I have a Wordpress blog and a Magento store. Both sites are using some kind of Newsletter plugin but I only do want to manage subscriptions via Wordpress.

The Wordpress blog is hosted on Wordpress.com and I'm using the "Follow Blog Widget".

Now I want to create an extension in Magento which pushes new subscriptions to Wordpress. According to the Wordpress Developer API we can use the API to add new Followers but the query parameters do not show any email address.

Is it possible to add new Followers (email subscribers) via API? If yes, any example will be much appreciated.

Using the direct url also does not work (getting an invalid email address):

https://subscribe.wordpress.com?email=example@gmail.com&action=subscribe&blog_id=1234567&source=https%3A%2F%2Fblog.example.com%2F&sub-type=widget&redirect_fragment=blog_subscription-8
  • This question would be better addressed in wordpress.com's official support channels. – bosco Mar 23 '17 at 22:20
  • Considering what you're trying to do (and I do understand that you want to manage your subscribers only on WordPress): Is there a way to manage the subscribers on your Magento install instead? As brianjohnhanna, it's not possible to pass on emails to WordPress. The reverse might be possible though. – ricotheque Mar 27 '17 at 5:34
  • Thanks for any helpful comment. I'll probably end up managing the subscribers in Magento – Stefan Mar 27 '17 at 9:20
2
+100

This API uses an oAuth2 approach. With the endpoint /sites/$site/follows/new, it looks like you'd have to prompt the user to authenticate themselves on Wordpress.com, get back a code, which you then have to exchange on an endpoint for access token. This is all explained here. The information stored in the Access Token you receive after the oAuth2 authentication would hold the user's information, and would be used to add them as a follower of your blog when you make the POST request.

Unfortunately, in as far as I can tell, there is no way to add a follower by email through the API directly.

I know it may not be the ideal solution, but it looks like your best bet is to create a follow button here: https://en.support.wordpress.com/follow-button/

Of course, you could go through the whole oAuth2 approach, but ultimately it'd probably be a lot easier to just generate the button. Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.