1

I'm working on a CRM implementation in Drupal for a client and they have an existing website with forms on for people to make enquiries and so on. They would like the data submitted via those forms to automatically become entities in the CRM.

I could replace the forms with webforms from the Drupal site but that would be clunky, as they would have to either be in iframes, or users would be taken to a separate site which would have to be styled the same and so on.

So ideally I would like to have their existing forms on the remote site POST the data to the Drupal server and then use that data to populate Drupal entities.

The only way that comes to mind is to have a PHP script on the server which processes the POST data and then bootstraps Drupal and creates the entity. But that seems somewhat clunky too. I'm wondering if there is a more Drupally way to do it.

Could Feeds be relevant I wonder? Could it be a custom feed type?

I'm interested in any ideas people have. Thanks!

1 Answer 1

0

Feeds

If you want to consume external data and produce entities from those data, then Feeds is the way to go. This is it's primary use case. Feeds is also a mature and well-known module with many tutorial resources on the Internet. Here is one that I think is suitable to your needs: https://www.drupal.org/docs/contributed-modules/feeds/creating-and-editing-import-feeds

REST API

The one "gotcha" to this solution is that Feeds relies on pulling data. If, instead, you must originate the request on the remote server, then Feeds won't help. Instead, you'll need to implement Drupal's REST API. Here is a reference: https://www.drupal.org/docs/8/core/modules/rest/3-post-for-creating-content-entities

Summary

The Feeds solution is faster and easier to implement, so, to whatever degree that you have control, I recommend making the remote data available via URL (e.g. via RSS) and then consuming it with Feeds, which can be set to execute on a regular basis. There are also a number of handy companion modules for Feeds, such as Feeds Tamper and Feeds Extensible Parsers.

1
  • Thank you! I am going with the REST API because the data needs to be POSTed from the remote server.
    – naomi
    Commented Jul 20, 2021 at 13:23

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.