Search code examples
phpunificationengine

unificationengine not working for pinterest


When I am sending a message by UnificationEngine in pinterest then getting so many errors main errors is:

vagrant@homestead:~/Code/laravel$ curl -XPOST https://apiv2.unificationengine.c
   om/v2/message/send  --data "{ \"message\": { \"receivers\": [{\"name\": \"Me\",
   \"address\": \"test.test\" , \"Connector\": \"pinterest\" }],\"subject\":\"tes
   t\",\"parts\": [{\"id\": \"0\", \"contentType\": \"binary\" , \"size\": 2211,\"
   type\": \"image_link\", \"name\":\"file name\",\"data\":\"http://www.hd-wallpap
   ersdownload.com/upload/bulk-upload/desktop-pictures-of-cute-kittens-and-cats-wa
   llpaper.jpg\",\"sort\":1},{\"id\": \"1\",\"contentType\": \"text/plain\", \"dat
   a\":\"test\" ,\"size\": 100,\"type\": \"body\",\"sort\":0}, {\"id\": \"2\",\"co
   ntentType\": \"text/plain\", \"data\":\"description2\" ,\"size\": 100,\"type\":
   \"link_description\",\"sort\":2},{\"id\": \"3\",\"contentType\": \"text/plain\"
   , \"data\":\"title2\" ,\"size\": 100,\"type\": \"link_title\",\"sort\":3},{\"id
   \": \"4\",\"contentType\": \"text/plain\", \"data\":\"http://www.amt.in\" ,\"si
   ze\": 100,\"type\": \"link\",\"sort\":4}]}}" -u USER_ACCESSKEY:USER_ACCESSSECRET

Getting this error:

{
  "Status": {
    "pinterest": {
      "status": 404,
      "info": "Not Found: "
    }
  },
  "URIs": [

  ]
}

PHP SAME CODE

    //its working fine

    $connection = $user->add_connection('FB', "facebook",  $request->access_token);

    //its working fine

    $tokens  = $oauth_token . ':' . $oauth_token_secret;
    $connection = $user->add_connection('TW', "twitter",   $tokens);

    // not working

    $connection = $user->add_connection('GP', "googleplus",  $request->access_token);

    // not working

    $connection = $user->add_connection("PT", "pinterest",  $request->access_token);

    $options = array(
        "receivers" => array(
            array(
                "name"=> "Me" //its working fine with twitter and fb
            )
        ),
         "message"=>array(
            "subject"=>"test",
            "body"=> "ABC",
            "image"=>"http://politibits.blogs.tuscaloosanews.com/files/2010/07/sanford_big_dummy_navy_shirt.jpg",
            "link"=>array(
                "uri"=> "http://google.com",
                "description"=> "link desc",
                "title"=>"link title"
            )
        )
    );
    //Send the message and get their uris
    $uris = $connection->send_message($options);
    return ['label' => $uris];

Unification working fine with twitter and facebook but not working with others


Solution

  • I could able to send by using following sample code. Can you please try with this?

    <?php
    
        require 'vendor/autoload.php';
        use UnificationEngine\Models\UEUser;
    
        $user = new UEUser("USER_ACCESSKEY","USER_ACCESSSECRET");
    
        $connection = $user->add_connection("pinterestBoard","pinterest","[email protected]/?id=BOARD_ID&is_profile=false&username=USER_NAME&profile_id=PROFILE_ID&connection_id=PINTEREST_PROFILE_CONNECTION_NAME&board_name=BOARD_NAME");
    
        $options = array(
              "receivers" => array(
                    array(
                        "name"=> "page",
                "id"=> "BOARD_NAME"// for pinterest board name in which the pin that you have to send
                    )
                ),
            "message"=>array(
             "subject"=>"ABC111",
              "body"=> "test",
              "image"=>"http://politibits.blogs.tuscaloosanews.com/files/2010/07/sanford_big_dummy_navy_shirt.jpg",
               "link"=>array(
                    "uri"=> "http://google.com",
                     "description"=> "",
                     "title"=>"Click here for view"
                )
            )
    
        );
    
            //Send the message and get their uris
            $uris = $connection->send_message($options); 
    
        print_r($uris);
        ?>