Last year (2016), I’ve been working on an interesting project – it’s purpose was to integrate a few CRMs into one WordPress website and with each other, and essentially automate some parts of the marketing process.
The basic logic behind the project was this:
- There’s a website with bunch of contact forms – for gated content (white papers and other docs, showroom, etc), for booking meetings at conferences, and some other – they all had the same fields in them.
- When someone submits the form, a few thing should happen.
- First, the new contact should be added into some MailChimp lists (there was a Master List which contained all the contacts and their general info and also some separate lists for each particular contact form).
- Second, the contact details should be added into JumpLead system.
- Third, an email notification should be send to the marketing department.
- Finally, the actual action requested by the user should be executed – i.e. he or she should be redirected to the showroom, or send an email with the requested document description and link, etc.
- Contacts who filled 2 forms or more should be exported io Zoho CRM (for some forms they should be exported instantly after submit).
And, of course, when someone fills one form on the website, the field values should be saved into browser for some time (1 week), so he\she wouldn’t have to enter this multiple times for other forms on the website.
- MailChimp – an online service for sending email campaigns. Popular and powerful, it has pretty good API that allows integration with other services, and automations for email workflow.
- JumpLead – an online service for lead tracking and conversion automation, chat system and also email campaigns. It has API for integration.
- Zoho CRM – leading online CRM service. Has pretty decent API and docs.
For each form, we’ve added a shortcut with different parameters. On a form submit, it called a function with AJAX call, added by this shortcut. This AJAX call submitted the form data to the plugin’s main functions, which then tried to add them into different systems using their APIs and cURL. It also added them into its own (plugin’s) SQL table, inside the WordPress database. It was useful in case there would be some errors on export to other systems – in case the API calls will fail, it should try to add them again later.
Some of the plugin functions were set to be called on a regular basis – each N minutes. In particular:
- Export from internal SQL table – in case there were some contacts who haven’t been exported yet.
- Checking the MailChimp lists for contacts with Lead\Prospect statuses – if some contact has met the requirements, he or she should be exported to Zoho.
The plugin also had a control panel in WP admin area, for settings (notification email addresses, API keys, etc) and buttons to manually trigger some events, like export.