- Pin info
- Create a pin
- Repin
- Edit pin
- Move pin to a new board
- Delete pin
- Copy/move pin
- Save image on disk
- Delete pin from board
- Get list of comments
- Write comment
- Delete comment from pin
- Pins for source
- User feed
- Activity for pin
- Related pins
- Trending pins
- Visual similar pins
- Send via message/email
- Pin analytics
- Share pin
- Leave reaction to pin
- Try pin
Notice! Try not to be very aggressive when pinning or commenting pins, or Pinterest will gonna ban you.
Get pin info by its id:
$info = $bot->pins->info(1234567890);
Create new pin. Accepts image url, board id, where to post image, description and preview url:
$pinInfo = $bot->pins->create('http://exmaple.com/image.jpg', $boardId, 'Pin description');
print_r($pinfInfo['id']);
You can pass a path to your local image. It will be uploaded to Pinterest:
$pinInfo = $bot->pins->create('image.jpg', $boardId, 'Pin description');
You can specify a link for pin (source) as fourth argument. If not set, link is equal to image url:
$pinInfo = $bot->pins->create(
'http://exmaple.com/image.jpg',
$boardId,
'Pin description',
'http://site.com',
);
If you have Rich Pins enabled, you can specify a title of the pin:
$pinInfo = $bot->pins->create(
'http://exmaple.com/image.jpg',
$boardId,
'Pin description',
'http://site.com',
'Pin title'
);
You can specify a board section id as the last argument:
$pinInfo = $bot->pins->create(
'http://exmaple.com/image.jpg',
$boardId,
'Pin description',
'http://site.com',
'Pin title'
$sectionId,
);
Repin a pin by its id. You need a pin id and a board id where you want to put this pin. The third parameter is a pin description and it is optional.
$pinInfo = $bot->pins->repin($pinId, $boardId, 'my repin');
Edit pin by id. You can change pin's description, link or board:
// Change description and link
$bot->pins->edit($pinId, 'new description', 'new link');
// Change board
$bot->pins->edit($pinId, 'new description', 'new link', $newBoardId);
// Change section
$bot->pins->edit($pinId, 'new description', 'new link', $newBoardId, $newSectionId);
If you have Rich Pins enabled, you can change a title of the pin:
$bot->pins->edit($pinId, 'new description', 'new link', $newBoardId, 'new
title');
Move pin to a new board:
// Change board
$bot->pins->moveToBoard($pinId, $newBoardId);
Delete pin by id:
$bot->pins->delete($pinId);
Copy/move pins to board. To copy/move one pin, pass it's id as the first argument. Pass an array of ids to copy/move many pins:
$bot->pins->copy($pinId, $boardId);
$bot->pins->move($pinId, $boardId);
Save image from pin to the disk. Saves original image of the pin to the specified path:
$imagePath = $bot->pins->saveOriginalImage($pinId, $pathForPics);
Delete pins from board. To delete one pin, pass it's id as the first argument. Pass an array of ids to delete many pins:
$bot->pins->deleteFromBoard($pinId, $boardId);
Get list of comments for a specified pin (returns Pagination object):
$comments = $bot->comments->getList($pinId);
foreach($comments as $comment) {
// ...
}
// retrieve all comments
$commnets = $bot->comments->getList($pinId)->toArray();
Write a comment:
$result = $bot->comments->create($pinId, 'your comment');
// Result contains info about written comment. For example,
// comment_id if you want to delete it.
Delete a comment:
$bot->comments->delete($pinId, $commentId);
Get pins from a specific url. For example: https://pinterest.com/source/flickr.com/ will return recent pins from flickr.com (returns Pagination object):
foreach ($bot->pins->fromSource('flickr.com') as $pin) {
// ...
}
Get user pins feed (returns Pagination object):
foreach ($bot->pins->feed() as $pin) {
// ...
}
// Only first 20 pins from feed
foreach ($bot->pins->feed(20) as $pin) {
// ...
}
Get activity of a pin (returns Pagination object):
foreach ($bot->pins->activity($pinId) as $data) {
// ...
}
If you don't want to get all activity records, you can pass a limit as the second parameter. Get 5 last activity records:
$activities = $bot->pins->activity($pinId, 5);
// print_r($activities->toArray());
foreach ($activities as $activity) {
// ...
}
Get related pins for current pin (returns Pagination object):
foreach ($bot->pins->related($pinId) as $pin) {
// ...
}
Get last 10 related pins for current pin:
$relatedPins = $bot->pins->related($pinId, 10);
// print_r($relatedPins->toArray());
foreach ($relatedPins as $pin) {
// ...
}
Get trending pins for a specific topic from http://pinterest.com/discover page. Uses topic id, that can be received
from $bot->topics->explore()
method (returns Pagination object):
$trendingTopics = $bot->topics->explore();
$firstTopicId = $trendingTopics[0]['id'];
$pins = $bot->pins->explore($firstTopicId)->toArray();
Get visual similar pins (returns Pagination object):
$result = $bot->pins->visualSimilar($pinId)->toArray();
foreach($bot->pins->visualSimilar($pinId) as $similarData) {
// ...
}
Send pin with message or by email:
// Send pin with message
$bot->pins->sendWithMessage($pinId, 'message', $userId); // To a user
$bot->pins->sendWithMessage($pinId, 'message', [$userId1, $userId2]); // To many users
// Send pin by email
$bot->pins->sendWithEmail($pinId, 'message', 'friend@example.com'); // One email
$bot->pins->sendWithEmail($pinId, 'message', ['friend1@example.com', 'friend2@example.com']); // Many
Get your pin analytics, like numbers of clicks, views and repins (only for business account);
$analytics = $bot->pins->analytics($pinId);
Share a link with a pin where a user can leave his or her reaction on this pin:
$link = $bot->pins->share($pinId);
Leave a reaction when you were given a sharing link with a pin.
The link looks like this: http://pin.it/cTwZfG_
. When you open it in your browser Pinterest redirects you to
the following url https://www.pinterest.de/pin/332703491213209642/sent/?sfo=1&sender=731835145606177283&invite_code=6cb1d66946464b3f9d0084f623c7822b
.
To react on this link you need to know a pinId (number after pin
) and a userId (number after sender
), who sent you a link:
// like
$bot->pins->leaveGoodReaction($pinId, $senderId);
// don't like
$bot->pins->leaveBadReaction($pinId, $senderId);
Get the pinners who have tied this pin (returns Pagination object):
$pinners = $bot->pins->tried($pinId);
// print_r($pinners->toArray());
foreach ($pinners as $pinner) {
// ...
}
Try a pin. The third parameter with path to image file is optional. Returns an array with data of the created record:
$tryRecord = $bot->pins->tryIt($pinId, 'comment', 'pathToImage');
Delete your try. You can use an id
field from data received when you created a tryIt record:
$tryRecord = $bot->pins->tryIt($pinId, 'comment', 'pathToImage');
// ...
$bot->pins->deleteTryIt($tryRecord['id']);
Edit your try. You can use an id
field from data received when you created a tryIt record. You also need a pin id for
your try:
$tryRecord = $bot->pins->tryIt($pinId, 'comment', 'pathToImage');
// ...
$bot->pins->editTryIt($tryRecord['pin']['id'], $tryRecord['id'], 'new comment', 'optionalPathToImage');