1

For a big client we are required to set up their blog on their Hubspot account. However we are developing everything else in Craft.

What is the easiest way to make the connection so the client can use Hubspot to post blog entries into our Craft site?

1 Answer 1

5

I would say you would need to create a custom plugin and use Hubspot webhooks.

Within this plugin you would have a controller method that, when you visit the action url, will take a response and convert it to an entry.

So for example if your plugin was called hubspotentries, you could have a controller HubspotEntries_WebhookController.php

Then inside that:

<?php
namespace Craft;

class HubspotEntries_WebhookController extends BaseController {

 protected $allowAnonymous = true;


 public function actionSync()
 {

   // If the webhook POSTS to the action url, get the php input and decode it
   $webhook = json_decode(file_get_contents('php://input'), true);

   //....Go through webhook and save entries etc.

 }
}

Your action url would be something like http://domain.com/actions/hubspotEntries/webhook/sync

You can then give this url to Hubspot and set up it so when an event occurs, they will POST or GET to this url and you'll be able to create the entries. I did something similar to this before (not hubspot but another service) and it works like a charm.

Useful Craft Documentation links

Plugin development introduction
Controllers in plugins

Hubspot Help

How do I use webhooks with HubSpot Workflows

Hope that helps you get started!

2
  • Wow, thank you very much! You have been an awesome help here. Really appreciate it!
    – Matteo
    Commented Aug 19, 2015 at 18:40
  • Not a problem :) Commented Aug 20, 2015 at 12:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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