Git Product home page Git Product logo

fuelsdk-php's People

Contributors

cmcculloh avatar creatovisguru avatar davidstanley01 avatar dereknutile avatar hjr3 avatar ipetresf avatar jfeltis avatar kejandre avatar manivinesh avatar michaelallenclark avatar mstratman avatar rhrituc avatar ryanjlowe avatar sfdrogojan avatar sharif26 avatar smunuswami avatar svc-scm avatar web20opensource avatar wyleilefflanator avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fuelsdk-php's Issues

Unable to validate App Keys(ClientID/ClientSecret) provided

When trying to set up the following simple example I'm seeing an error:

require __DIR__ . '/vendor/autoload.php';
use FuelSdk\ET_Client;
use FuelSdk\ET_List;
$myclient = new ET_Client();
Fatal error: Uncaught Exception: Unable to validate App Keys(ClientID/ClientSecret) provided.: Unable to validate App Keys(ClientID/ClientSecret) provided, requestToken response: in /salesforce/vendor/salesforce-mc/fuel-sdk-php/src/ET_Client.php:255 Stack trace: #0 /salesforce/vendor/salesforce-mc/fuel-sdk-php/src/ET_Client.php(162): FuelSdk\ET_Client->refreshToken() #1 /salesforce/example.php(10): FuelSdk\ET_Client->__construct() #2 {main} thrown in /salesforce/vendor/salesforce-mc/fuel-sdk-php/src/ET_Client.php on line 255

Trying to debug this, if I add the following to ET_Client.php (line 234):

print_r($jsonRequest);
exit;

This shows that the config file is being included correctly and I can see my clientid and clientsecret.

Also uncommenting lines 239-240 returns blank:

echo "auth:  \n";
print_r($authResponse);

So there's obviously some issue with the post request being sent.

Any ideas?

CreateAndStartDataExtensionImport is not working - Guid should contain 32 digits with 4 dashes

Caught exception: Unable to create import definition due to: ET_Post Object
(
[status] =>
[code] => 200
[message] =>
[results] => Array
(
[0] => stdClass Object
(
[StatusCode] => Error
[StatusMessage] => Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
[OrdinalID] => 0
[NewID] => 0
[Object] => stdClass Object
(
[PartnerKey] =>
[ObjectID] =>
[CustomerKey] => 591328f9bd7da
[Name] => SDK Generated Import 591328f9bd7da
[Description] => SDK Generated Import
[AllowErrors] => 1
[DestinationObject] => stdClass Object
(
[PartnerKey] =>
[ObjectID] => MGO_Country_Language
)

                        [FieldMappingType] => InferFromColumnHeadings
                        [FileSpec] => MGO_Country_Language.csv
                        [FileType] => CSV
                        [RetrieveFileTransferLocation] => stdClass Object
                            (
                                [PartnerKey] =>
                                [ObjectID] =>
                                [CustomerKey] => ExactTarget Enhanced FTP
                            )

                        [UpdateType] => Overwrite
                    )

            )

    )

[request_id] =>
[moreResults] =>

)

How to find the email address attribute on the ET_ProfileAttribute class?

Hello there. First off, thank you for this library, it is working pretty well for us.

I'm trying to use this library to build integration for Drupal 8 but have ran into a slight stumbling block. Our client wants to use this system for signing website visitors up for newsletters. I've built out a system to map fields from the signup form to ET attributes, but I've hit a slight stumbling block - I can't tell what attribute is the email address? There are 175 attributes available using ET_ProfileAttribute::get() but none mention "email". Might there be another method I should use to obtain this?

Thank you.

Issues with FUEL

Hey Michael,

I have been using your SDK and have found a few issues,

I have pushed commits to fix them on this branch: https://github.com/derpest/FuelSDK-PHP/commits/master - Please let me know what you think. Feel free to include my changes or you can address the issues yourself:

  • number of paramaters in the doRequest function doesn't align with the SOAP class, this throws an error when PHP strict is enabled.
  • Return type from retPost is not a String, it is an object - this causes a number of conversion issues when exceptions are thrown.
  • I don't think calling proprety_exists with an instance method instead of a class works. It throws a warning, I think it might be better to use isset instead.

Thanks, I will continue pushing my fixes to my own branch

Send Object doesn't have Total Clicks or Total Opens?

Hello there,

Great job with this SDK. I'm working with the Send Object and it's pulling everything I need, EXCEPT Total Sends and Total Opens. Is this an available property I can pull or do I have to do this a different way?

Compile errors on strict

Hi,

In my local environment which is a bit more forgiving of errors (PHP 7), my code works. However in my server environment which has stricter error checking (HHVM) I get the following errors:

Please can you correct?

Warning: __soapcall() expects parameter 3 to be array, null given in lib/FuelSDK-PHP/ET_Client.php on line 695

Warning: First parameter must either be an object or the name of an existing class in /lib/FuelSDK-PHP/ET_Client.php on line 699

Notice: Cannot access property on non-object in /lib/FuelSDK-PHP/ET_Client.php on line 710

ET_Client.php line 164

In function AddSubscriberToList on line 164 of ET_Client.php, shouldn't that be "$lists[]" (with the "s" at the end), rather than:

$list[] = array("ID" => $value);

?

You define $lists above that line:
$lists = array();
and then call $lists below that line:
$newSub->props = array("EmailAddress" => $emailAddress, "Lists" => $lists);

Issues w/ PHP 5.3.26 on Mac

This will only apply to people using Mac for local development and I've only tested with 5.3.26:

  1. Timezone definition throws errors (can't use system time, fix I used is below)

$currentTime = new DateTime("now", new DateTimeZone( 'America/Los_Angeles' ));

  1. Cannot parse the WSDL (error below)

Warning: SoapClient::SoapClient() [soapclient.soapclient]: I/O warning : failed to load external entity "ExactTargetWSDL.xml" in /Users/[username]/Apps/[appname]/ET_Client.php on line 61

Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'ExactTargetWSDL.xml' : failed to load external entity "ExactTargetWSDL.xml" in /Users/[username]/Apps/[appname]/ET_Client.php on line 61

ET_Subscriber->post() isn't subscribing new users?

While building Exact Target integration for a CMS I'm having problems getting the submission to work as intended.

This is a trimmed down example of the code being used, which was mirrored off the "Sample SOAP Envelope - Create a Subscriber with Attributes" example from the SOAP API docs page:

$subscriber = new ET_Subscriber();
$subscriber->authStub = $client;
$subscriber->props = [
  'EmailAddress' => '[email protected]',
  'Lists' => [
    ['ID' => $newsletter_id],
  ],
  'Attributes' => [
    [
      'Name' => $last_name_attribute_id,
      'Value' => 'My first name',
    ],
    [
      'Name' => $last_name_attribute_id,
      'Value' => 'My last name',
    ],
  ],
];
$result = $subscriber->post();
?>

The $result->status equals TRUE for this request.

However, the submission does not show up on the subscribers list for the $newsletter_id newsletter.

Any idea why the above isn't working? Thanks.

Starting a journey from data extension

Hi,

I've managed to push some data to a data extension on SFMC. It's supposed to trigger a journey but it does not.

I've been asked to pass the following params, and I am doing this in additional attributes. However I think they need to be there in root array when sending, is this an issue?

[contactKey] => SubscriberKey
[eventDefinitionkey] => ContactEvent-xxxx

Insert multiple data extension Rows in one call

While this looks eminently doable from the WSDL, I have not succeeded in inserting multiple rows into a data extension in one call. Every attempt to create the correct structure ends with a PHP error:

PHP Fatal error:  SOAP-ERROR: Encoding: object has no 'Name' property

A method or example of doing this would be greatly appreciated, so I don't have to hammer your API with individual inserts (the number make the complexity of a data import via FTP not worthwhile)

Content is being double encoded

on line 167 of ET_Client.php, $objWSSE->saveXML() is surrounded by utf8_encode
This is not needed, because this causes a double utf8 encode.
By removing the surrounding function and just setting it to:
$content = $objWSSE->saveXML();

This solved my issue of being able to send correct encoding to data extensions for multiple languages.

Missing Attributes

Hi,

I have been using sample-send.php to retrieve the tracking information for emails.I am unable to find the property for Total Clicks, Total Opens, Lists, Total Unsubscribes, Did not click, Did not open.

I would appreciate if you help me with this issue.

Regards,
Vijay Ayilavarapu

Logging PHP Warnings

Experienced with "salesforce-mc/fuel-sdk-php": "1.1.0",

PHP Warning: Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' (this will throw an Error in a future version of PHP) in /app/vendor/robrichards/xmlseclibs/src/XMLSecurityKey.php on line 136
PHP Warning: Use of undefined constant MCRYPT_MODE_CBC - assumed 'MCRYPT_MODE_CBC' (this will throw an Error in a future version of PHP) in /app/vendor/robrichards/xmlseclibs/src/XMLSecurityKey.php on line 137
PHP Warning: Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' (this will throw an Error in a future version of PHP) in /app/vendor/robrichards/xmlseclibs/src/XMLSecurityKey.php on line 136

The above seems to be related to the dependency on ""name": "robrichards/wse-php" which is going to require the "robrichards/xmlseclibs": "^2.0"

PHP 7.1 support

mcrypt_ functions are now depreciated and used in xmlseclibs.php

Force REST API

I'm getting this error:

PHP Fatal error:  SOAP-ERROR: Parsing WSDL: Couldn't load from '/tmp/ExactTargetWSDL.xml' : failed to load external entity "/tmp/ExactTargetWSDL.xml"
 in myapp/Vendor/leowebx/fuelsdk-php/src/ET_Client.php on line 81

I don't want to use SOAP in the first place. How can I force Fuel to use the REST API?

How to specify subaccount in data extension new row?

I am trying to add a row to a data extension, through a sub account.

I have specified the customerKey but this does not work. It works fine on the main account.

$postDRRow = new ET_DataExtension_Row();
$postDRRow->authStub =  $this->getClient();
$postDRRow->props = $props;
$postDRRow->CustomerKey = $externalKey;
$response = $postDRRow->post();

What I get back is:

Unable to retrieve Data Extension using CustomerKey

Refactor usage of RefreshToken to limit usage

The RefreshToken used by auth is needed when consuming a JWT for authentication however it becomes problematic when used by a server-to-server application that involved multi-threading.

SSL: CA certificate set, but certificate verification is disabled

Cannot download wsdl due to SSL error. I'm on OSX 10.11.6, have cURL installed via homebrew (and it is up to date). The current way I am able to work around this error is by changing line 168 from:

curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

to

curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);

Failed installation via composer

I'm new to SDK-PHP and stuck on installing it via composer. I am currently using WAMP server 3.1.0 for Windows 10 which has 3 versions of PHP included. As documentation said version 5.6.24 is required for SDK-PHP. So I tried available 5.6.31 and got this from composer

composer require salesforce-mc/fuel-sdk-php
Using version ^1.1 for salesforce-mc/fuel-sdk-php
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - doctrine/annotations v1.6.0 requires php ^7.1 -> your PHP version (5.6.31) does not satisfy that requirement.
    - doctrine/annotations v1.6.0 requires php ^7.1 -> your PHP version (5.6.31) does not satisfy that requirement.
    - doctrine/annotations v1.6.0 requires php ^7.1 -> your PHP version (5.6.31) does not satisfy that requirement.
    - Installation request for doctrine/annotations (locked at v1.6.0) -> satisfiable by doctrine/annotations[v1.6.0]. 
Installation failed, reverting ./composer.json to its original content.

Then I changed PHP version to available 7.1.9 but that was not successful as well

 composer  require salesforce-mc/fuel-sdk-php

 Using version ^1.1 for salesforce-mc/fuel-sdk-php
 ./composer.json has been updated
 Loading composer repositories with package information
 Updating dependencies (including require-dev)
 Your requirements could not be resolved to an installable set of packages.
 
   Problem 1
     - Installation request for salesforce-mc/fuel-sdk-php dev-master -> satisfiable by salesforce-mc/fuel-sdk-php[dev-master].
     - Can only install one of: salesforce-mc/fuel-sdk-php[v1.1.0, dev-master].
     - Installation request for salesforce-mc/fuel-sdk-php ^1.1 -> satisfiable by salesforce-mc/fuel-sdk-php[v1.1.0].
 Installation failed, reverting ./composer.json to its original content.

Would anyone be able to help resolving this issue?

WSDL Cache Permission

We're storing the cached WSDL in the webroot. Is this an acceptable place to store it?

I'm only asking because I had a permissions issue storing the cache on my local machine. Of course in production, typically the webuser has all the necessary permissions.

Just thought I'd ask other's opinions.

wsdlLoc?

Should the "sdl" on this line actually be wsdlLoc instead?

Seems that way since I don't see sdl declared anywhere else.

Pagination

First, thank you for the work you have done with this library. I have a question about pagination. I am working specifically with data extensions and I see that the response shows that there is more data than the 2500 rows returned. I don't see a way to traverse through the entire data extension. Is this possible?

Add configurable time out for cURL requests

There is currently no way to limit the amount of time cURL takes to connect or transfer data. This can mean requests/scripts will run for minutes before timing out. Adding a configurable time out would allow these requests/scripts to fail quickly and be handled in a more user-friendly way.

Failed opening required vendor/autoload.php

I have a question about the autoload require in ET_Client.php. What is the purpose of this line?

When trying to use the ET_Client class I get the following error:

(1/1) FatalErrorExceptionmain(): Failed opening required '/var/project/vendor/salesforce-mc/fuel-sdk-php/src/../vendor/autoload.php' (include_path='.:/usr/share/php')

If I comment the line out or change it to require __DIR__ . '/../../../autoload.php'; then I don't receive an error and everything seems to function normally.

I followed the installation instructions from the README to include this SDK in a custom Laravel 5.4 based tool that I'm working on. One change that I did make was that I added the SDK into the autoloader manually because otherwise it doesn't seem to get added.

"autoload": {
        "classmap": [
            "database",
            "vendor/salesforce-mc/fuel-sdk-php/src"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },

Starting an interaction, adding to data extension?

How do I use the API to start an interaction? I already added the user to a data extension but no event is fired.

The data I was given was to post to /interaction?

HOST: https ://www. exacttargetapis.com
POST /interaction/v1/events
Content-Type: application/j son
Authorization: Bearer insertAccessTokenHere
{
“contactKey”: “SubscriberKey”,
“eventDefinitionkey” : “ContactEvent-xyz,
“data” :{
“SubscriberKey”: “insertCustomerldHere”,
“EmailAddress”: [email protected],
“Title” : “Mr”,
“FirstName” : “Sinon”,
“LastName” : “Stanley”,
“Product_Category” : “Steamers”,
Model_Type:“VX21”,
SMS_Opt_In : “True”,
Phone: “04234555”
}
}

Boolean Values

According to this documentation:

https://help.exacttarget.com/sv/documentation/exacttarget/subscribers/data_extensions_and_data_relationships/data_types/

Passing a value of 1 to a column expecting a boolean value should work to indicate TRUE. However, I've only been able to get this to work:

    $dataextensionrow->props = array(
      "Email" => $Email, 
      "XXXXX" => "true" // column expects boolean
     );

While when I try this:

    $dataextensionrow->props = array(
      "Email" => $Email, 
      "XXXXX" => "1" // column expects boolean
     );

Or this:

    $dataextensionrow->props = array(
      "Email" => $Email, 
      "XXXXX" => 1 // column expects boolean
     );

I get the following error:

{ ["ValueError"]=> object(stdClass)#19 (3) { ["Name"]=> string(17) "BOOLEAN_COLUMN" ["ErrorCode"]=> int(2) ["ErrorMessage"]=> string(120) " String was not recognized as a valid Boolean.Couldn't store <1> in BOOLEAN_COLUMN Column. Expected type is Boolean." }

I can find a way around this, but it would be really great to be able to pass a 1, because the columns I'd like to pass essentially boolean values to are not actually all boolean columns. Some are set to accept a single text character instead (because these columns may potentially be changed to accept multiple characters later, and changing column type is not otherwise possible.) It would be great to not have to write a conditional to pass a different value (1 vs. TRUE) depending on the column's type. Has anyone else experienced/resolved this issue?

Requirement config.php in project root doesn't play well with symfony

I forked this repository to get the SDK to more easily load into Symfony, and probably other frameworks such as Laravel. It's available on Packagist.

I am not a Symfony expert, but we already have a config.php in our web root and it is generated by Symfony and it cannot be changed, so this library was a non-starter to use as is.

I read a few of different PRs and incorporated some of them, and updated the README.md

A lot of work needs to be done on it to update the examples, but it's working fine in Symfony for us without config.php. In essence, I just pass everything I need to the constructor. I also pass along debug flag to the CUDUtils class and ET_Post making it easier to debug requests and responses.

I don't want to submit a PR yet because I believe it's a lot of breaking changes and unfinished but wanted to let you know about it and future Symfony and Laravel developers to try my branch. All feedback welcome.

Setting Data Extension properties

The example for adding data extension rows says to use this:

$postDRRow->props = array("Key" => "PHPSDKTEST", "Value" => "ItWorks");

But the source code for ET_DataExtension_Row > post() has this:

foreach ($this->props as $key => $value){
    $fields[]  = array("Name" => $key, "Value" => $value);  
}

So it looks like, really, properties should be set like this:

$postDRRow->props = array(
    "MyKey1" => "MyValue1",
    "MyKey2" => "MyValue2"
);

Can you confirm?

Hydrated Responses on POST/PUT/PATCH

The Fuel REST APIs all return hydrated responses on POST/PUT/PATCH operations.

It would be nice if the SDKs could reduce the invalidations required by developers by encapsulating this functionality.

Thoughts on this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.