September 30, 2020

How to code PHP to automate LinkedIn with the Dux-Soup API

How to code PHP to automate LinkedIn with the Dux-Soup API

The Dux-Soup API is an open API included in Dux-Soup Turbo. It allows developers to integrate LinkedIn outreach into sales and marketing campaigns.

For example, you can send automated connection requests when a prospect reads your content or keep a record in your CRM of each message you send and receive in LinkedIn. 

In this blog, we’ll cover 2 aspects of the Dux-Soup API - Webhooks and the Remote Control. We’ll also show you how to code PHP to listen for visit data and how to send activities to the queue using the Remote Control. 

Note: This is an advanced topic requiring some understanding of PHP. For the purposes of this blog, we have assumed that you already have a degree of understanding of PHP and won’t cover the basics of PHP setup.


Dux-Soup API basics

The Dux-Soup API works by creating a 2-way communication channel between your PHP environment and LinkedIn.

It  makes use of  Webhooks and Remote Control features to send automated messages/actions and receives vital prospect information from LinkedIn.


Webhooks

With Dux-Soup Webhooks you can send details of various events that occur in LinkedIn, like visiting and connecting, to other systems that you are using to manage and monitor your lead generation efforts. Events that are supported include:

  • ‘scan’ events - deliver structured profile data of profiles you scan
  • ‘visit’ events - deliver structured profile data of profiles you view
  • ‘action’ events - deliver details of the actions that you take on profiles, so you can easily keep track of them.
  • ‘message’ events - delivers all messages you send and receive in LinkedIn and Sales Navigator Message box.
  • ‘remote control’ events - deliver details of remote control events you have scheduled.

Details of these and other events can be found here.


Remote Control

With Dux-Soup Remote Control you can control activity in LinkedIn from any other system that you use for managing your marketing and sales activity. Activity that is supported includes:

  • View a Profile -  to automatically open a profile in LinkedIn
  • Invite a Profile -  to send a connections request, including a personalised message
  • Message a Profile - to send a direct message to a 1st-degree connection in LinkedIn

Details of these and other commands can be found here.

Put simply, the Webhook will gather information about your Dux-Soup activities and the Remote Control will implement all scheduled events: follow-up messages, events scheduled directly using the Remote Control and events scheduled in other systems, for example, Zapier, Leadfuze, Salesforce or Pipedrive.

The Dux-Soup API is part of Dux-Soup Turbo and is an Open API available to anyone who has purchased this product.


Installing the PHP package

Let’s assume that you have already installed PHP 7 on your computer. We recommend to also install Visual Studio Code, which is a great free code editor. You can download it here . However, it is not required to run the PHP scripts.  

  • First, download and unzip the PHP script. You can find it here.
  • Then, start a command line and change to the folder that was just created. 
  • Finally, run php and start the embedded web server on port 8080: php -S localhost:8080

The port number cannot be changed as the Dux-Soup extension can only access this specific port on localhost.

 You must leave this command prompt open, and continue with the next steps.

Capturing LinkedIn data

We are going to carry out auto-visits, catch the webhooks and record it in the CSV file that gets amended every time you carry-out a new visit.

Once the Command Prompt and the Visual Code are set, go to Dux-Soup Options, Connect tab and set the webhook to listen to appropriate events. 



The file will appear in the File Manager once you click on the “Send Sample” data.

To check the server’s performance, you can go back to the Command Prompt and see that it’s  running:


When you run Dux-Soup on LinkedIn or visit these profiles manually, the details of the profiles you are visiting will be automatically sent to the CSV file by the PHP script.

 

Tip: You can check if the webhooks are delivered successfully or not. To do so, open chrome://extensions/ , enable the developer mode ( top right ) and click on “Details” for Dux-Soup. This opens the developer console. Here, you need to select the “network” tab at the top to see the webhook events being sent to the PHP web server on port 8080.

Your CSV file is saved in the same folder where you run the server and it’s updated in real-time. Note that the most recent event is always cached until the next is sent. So keep visiting to get the data in the file.


Queueing LinkedIn automations

To queue automations you can use the dux-remotecontrol.php script. This script can queue 3 types of LinkedIn actions: connect, visit and message.

The php script reads from the rc-commands.txt file to determine what actions to queue:

By default, if you have only URLs in the file, Dux-Soup will carry out the visit action only. Otherwise you need to use the following format to specify what to queue:

<connect|visit|message> <profile url=""> [run after date]</profile></connect|visit|message>

  • Using connect, visit or message commands, you can specify what action you want to execute on LinkedIn. 
  • The Profile URL can be a regular LinkedIn profile or a Sales Nav profile URL
  • Optionally, you can specify the time after which you want the action to take place. The date should be in ISO string format.


When you queue direct message or connection request actions, you need to add text files containing your message template. For example:

Please keep in mind the limits for the connection request and direct message - 300 and 3000 characters respectively. Also, the message markers take 4 characters - however, they might convert into longer than 4 character values. It’s good practise to keep your message templates a little shorter than the maximum message limit.

Once you run the Remote Control command in Command Prompt, you need to copy Remote Control credentials from Dux-Soup Options, Connect tab:

and paste them into Command Prompt:

Note:  the queue will never add an already queued command twice.

Once you add the command, it will appear in Dux-Dash’s Queued Automations section.



Watch the webinar recording to learn more

In this webinar, Giles Garnett, Head of Professional Services at Dux-Soup and Gin Kuzmiskaite, Head of Customer Support, give a practical demonstration of the content in this blog. Watch the webinar recording here.


Summary

This is the first blog in our API series - helping developers to automate LinkedIn outreach with Dux-Soup. We have shown you how to code PHP to automate LinkedIn with the Dux-Soup API - so that your lead generation is seamless, effortless and more productive! 

If anything is unclear or you have any questions, drop us a line at info@dux-soup.com 

Or why not book an hour-long Turbo Technical Session (using the same email) for more in-depth advice and support. 

We’re always more than glad to help you out!


Arrow to discover more

See all blogs

Latest blogs

Dux-Soup Product Tips

Save 50% of your time on recruitment, using Dux-Soup with LinkedIn Recruiter. Learn how to scan, visit, send connection requests and enroll LI Recruiter profiles into Dux campaigns

June 15, 2022
linkedin icon
Dux-Soup Product Tips

Learn how to use InMail messaging with Sales Navigator or Recruiter to bypass LinkedIn limits, scale your outreach and get more leads.

June 8, 2022
linkedin icon
Dux-Soup News

With tips on the best marketing tools, simple ways to create email lists and expert strategies on achieving 85% response rates from your outreach - June Quacks has it all!

June 3, 2022
linkedin icon
Lead Generation Insights

Revive your marketing strategy with this 6-step approach to success - and learn about the tools that help you get there - Marketing guru Gaurav Sharma shares his secrets.

May 27, 2022
linkedin icon
LinkedIn Hacks

Email marketing is STILL one of the most effective marketing strategies. Discover how Dux-Soup can help you get emails from LinkedIn and scale-up your led gen efforts.

May 19, 2022
linkedin icon
Dux-Soup News

Packed full to the brim with expert advice on all things lead generation - this month's Quacks covers customization, 1st-degree drip campaigns, InMail hacks and much more!

May 6, 2022
linkedin icon
Lead Generation Insights

We take an in-depth look at the best LinkedIn automation tools on the market right now (because we know we aren't the only one out there).

April 27, 2022
linkedin icon
Dux-Soup Product Tips

Are you looking to create a 1st-degree drip campaign using LinkedIn automation? it's easier than ever with our Dux-Soup easy-to-follow guide! Read on to find out 

April 12, 2022
linkedin icon
Dux-Soup News

Awesome new Dux features, a guest webinar packed full of tactics for successful online growth and LinkedIn lead gen strategies you should be using in 2022 - all that and much more!

April 1, 2022
linkedin icon