I received a task as a part of a recruitment process although PHP and Salesforce developer experience was not specified as a requirement, but I want to try to finish it and learn something new.

I have the following data:

  • Client ID
  • Client Secret
  • Athentication Target
  • Data Extension External Key

What needs to be done with it:

Create a sample form integration that subscribes the user to a newsletter (i.e. one field) on a page written in PHP.

Use the following link for reference: https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/index-api.htm

I know a bit about PHP and how it connects with SQL so I will create a local version on a XAMPP server first. I've already created a developer account and downloaded the Force.com Toolkit for PHP (Version 20.0) and the PHP API starter kit.

My questions are as follows:

  1. Do I have all the necessary data?

  2. When and where do I use the data above?

  3. Does the data somehow force a specific approach (SOAP or REST)?

  4. Can I somehow test if I fail/succeed? I should send the answer via e-mail.

  • Is this a homework or interview question by chance? It kind of reads that way. Dec 7 '16 at 22:31
  • You're right. It's a pre-interview question. I never mentioned salesforce in my resume and this task totally suprised me. Don't know if they are using this challenge to see if I'm more fit for a different position or if it's used as a tactic to discourage me. I'm not expecting a solution, just the answers to be sure if I have everything I need. Dec 7 '16 at 22:35

That will be quite easy. You actually don't even need to utilize any local DB. Assuming your PHP skills are adequate, you should have a look at the PHP SDK, which can be found on GitHub: https://github.com/salesforce-marketingcloud/FuelSDK-PHP

You should especially have a look at Create Subscriber example:

$myclient = new ET_Client();
$subscriber = new ET_Subscriber();
$subscriber->authStub = $myclient;
$subscriber->props = array("EmailAddress" => "example@example.com", "SubscriberKey" => "SDKSubscriber");
$subscriber->props['Attributes'] = array(array('Name' => 'First Name', 'Value' => 'ExactTarget Example'));
$results = $subscriber->post();

Which can be found here: https://developer.salesforce.com/docs/atlas.en-us.mc-sdks.meta/mc-sdks/subscriber-create.htm

And yes - you have all the info you need. You will be able to use the $results to verify a succesful subscriber creation.

Good luck!

  • 1
    I know i'ts late to say it, but I would really like to thank you for taking the time to read and write the helpful tip - Fuel SDK was indeed the key. Dec 9 '16 at 13:24

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.