Answer the question
In order to leave comments, you need to log in
Discount for reposting through the site?
Is it possible to make it so that when adding a certain post to the wall, give the user some kind of discount? I followed the example:
$('.getbonus').on('click', function(){
if (!$(this).hasClass('disabled')){
var message = $(this).attr("data-message");
hClick(message);
}
})
function hClick(message) { // обработчик нажатия
VK.Api.call('wall.post', {
message:message,
attachments:"https://site.ru"
}, hPost);
}
function hPost(r) { // обработчик окончания выполнения API запроса
if(!r) throw "Bad response from VK";
if( r.error) { // если отказался постить
console.log("Not posted. Error:", r.error);
} else if( r.response) {
if( r.response.post_id) { // это id свежесозданного поста
console.log("Posted with id ", r.response.post_id);
console.log("Скидка получена", r.id);
} else {
console.log("No post id, no idea why", r);
}
} else {
console.log("Not posted, no idea why", r);
}
}
Answer the question
In order to leave comments, you need to log in
https://vk.com/dev/share_details
https://vk.com/dev/objects/post
To read the wall, you need to authorize the user through vk with the appropriate permissions, since you need to know the user uid
https://vk.com/ dev/access_token
Simple option: Add a parameter to the link, and give a discount on the first transition from the repost to the site.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question