create account

How to Broadcast a Comment to a specific user link by yanosh01

View this thread on: hive.blogpeakd.comecency.com
· @yanosh01 · (edited)
$20.14
How to Broadcast a Comment to a specific user link
![new-york-1071162_1280.jpg](https://steemitimages.com/DQmVsxpdtrcou2s2bAWGQ2JkkPrEjSXARoBvEWR32YDTNdo/new-york-1071162_1280.jpg)
[CC0 Creative Commons Pixabay](https://pixabay.com)

Hi everyone today we explain about the possibility to use the Steem Api to broadcast a comment on a specific user post.
I use the comment on the @steemrepo project because our curators choose good quality posts and can make the upvote/comment on a post directly by our discord server:

![Immagine.png](https://steemitimages.com/DQmfX9LTHR7Xt2sNLVr73zwmqDZgJkhmbUfeUPTdtUchQhG/Immagine.png) 

We use discord because we take this two var used on the script:

>Author: the post author
Permlink: the link of the post author

<h2>Requirements</h2>
Installing the libraries:

>sudo apt-get install nodejs
sudo apt-get install npm
npm install steem --save

<h2>Write the Code</h2>

```
var steem = require("steem");
var wifkey = youprivatepostingkey;
var author = postauthor;
var permlink = thelinkoftheposttocommenton;
var author1 = theuserwewillusetocomment;

  steem.broadcast.comment(
    wifkey,
    author, // Parent Author
    permlink, // Parent Permlink
    author1, // Author
    steem.formatter.commentPermlink(author, permlink),
    '', // Title
    'The comment you wanna add on a post' , // Body,
   { tags: ['test'], app: `steemjs/examples` }, // Json Metadata
    function(err, result) {
      console.log(err, result);
    }
  );
```

<h2>Explain the variables</h2>

To comment on a specific user post we use the steem.js functions called 
**"steem.broadcast.comment"**
**"steem.formatter.commentPermlink"**

- wifkey = the private posting key of the users we are using to comment
- author = called Parent Author is the author of the post we are commenting on
- permlink = is exactly the url we are commenting on
- Author1 = is the username related to the wifkey we are using to comment

Let me do an example:

Imagine you are @yanosh01 and you want to comment this @steemrepo post:

https://steemit.com/steemrepo/@steemrepo/steemrepo-rewarding-undervalued-content-creators

it will be:

- wifkey = the private posting key of yanosh01
- author = steemrepo
- permlink = steemrepo-rewarding-undervalued-content-creators
- Author1 = yanosh01

---------------

<h3>If you like what i'm doing, please upvote me as your Witness</h3>

https://steemit.com/~witnesses

![witness.gif](https://steemitimages.com/DQmbVGHGMJNhUpmqUTeDvvMGaevzaNFdib24Sa9XhVS48XM/witness.gif)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authoryanosh01
permlinkhow-to-broadcast-a-comment-to-a-specific-user-link
categorysteemrepo
json_metadata{"tags":["steemrepo","development","steemdev","help","minnow"],"users":["steemrepo","yanosh01"],"image":["https://steemitimages.com/DQmVsxpdtrcou2s2bAWGQ2JkkPrEjSXARoBvEWR32YDTNdo/new-york-1071162_1280.jpg","https://steemitimages.com/DQmfX9LTHR7Xt2sNLVr73zwmqDZgJkhmbUfeUPTdtUchQhG/Immagine.png","https://steemitimages.com/DQmbVGHGMJNhUpmqUTeDvvMGaevzaNFdib24Sa9XhVS48XM/witness.gif"],"links":["https://pixabay.com","https://steemit.com/steemrepo/@steemrepo/steemrepo-rewarding-undervalued-content-creators","https://steemit.com/~witnesses"],"app":"steemit/0.1","format":"markdown"}
created2018-05-15 22:33:48
last_update2018-05-20 10:16:15
depth0
children4
last_payout2018-05-22 22:33:48
cashout_time1969-12-31 23:59:59
total_payout_value15.744 HBD
curator_payout_value4.397 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,454
author_reputation12,371,240,230,142
root_title"How to Broadcast a Comment to a specific user link"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id55,900,675
net_rshares4,107,781,391,932
author_curate_reward""
vote details (30)
@postpromoter ·
re-yanosh01-how-to-broadcast-a-comment-to-a-specific-user-link-20180515t232455078z
You got a 3.23% upvote from @postpromoter courtesy of @yanosh01!

Want to promote your posts too? Check out the [Steem Bot Tracker website](https://steembottracker.com) for more info. If you would like to support the development of @postpromoter and the bot tracker please [vote for @yabapmatt for witness!](https://v2.steemconnect.com/sign/account-witness-vote?witness=yabapmatt&approve=1)
properties (22)
authorpostpromoter
permlinkre-yanosh01-how-to-broadcast-a-comment-to-a-specific-user-link-20180515t232455078z
categorysteemrepo
json_metadata{"app":"postpromoter/2.0.0"}
created2018-05-15 23:24:54
last_update2018-05-15 23:24:54
depth1
children0
last_payout2018-05-22 23:24:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length391
author_reputation12,722,616,650,811
root_title"How to Broadcast a Comment to a specific user link"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id55,906,197
net_rshares0
@steemfunder ·
$0.03
I just found your account today. I appreciate these short tutorials. They are useful to a new developer like me. I am working towards building multiple projects connected to the Steem blockchain.
👍  
properties (23)
authorsteemfunder
permlinkre-yanosh01-how-to-broadcast-a-comment-to-a-specific-user-link-20180515t224632614z
categorysteemrepo
json_metadata{"tags":["steemrepo"],"app":"steemit/0.1"}
created2018-05-15 22:46:33
last_update2018-05-15 22:46:33
depth1
children2
last_payout2018-05-22 22:46:33
cashout_time1969-12-31 23:59:59
total_payout_value0.033 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length195
author_reputation124,324,143,886
root_title"How to Broadcast a Comment to a specific user link"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id55,902,127
net_rshares7,305,286,539
author_curate_reward""
vote details (1)
@yanosh01 ·
It's a pleasure. My focus is on javascript, so if you need any help you can contact me on @steemrepo Discord server or on Developers Discord server. Feel free to ask me whatever you need!!!
properties (22)
authoryanosh01
permlinkre-steemfunder-re-yanosh01-how-to-broadcast-a-comment-to-a-specific-user-link-20180515t225229320z
categorysteemrepo
json_metadata{"tags":["steemrepo"],"users":["steemrepo"],"app":"steemit/0.1"}
created2018-05-15 22:52:33
last_update2018-05-15 22:52:33
depth2
children1
last_payout2018-05-22 22:52:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length189
author_reputation12,371,240,230,142
root_title"How to Broadcast a Comment to a specific user link"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id55,902,769
net_rshares0
@steemfunder ·
I will definitely reach out. My main account is @nikema here and on discord. Thank you so much!
properties (22)
authorsteemfunder
permlinkre-yanosh01-re-steemfunder-re-yanosh01-how-to-broadcast-a-comment-to-a-specific-user-link-20180515t230037920z
categorysteemrepo
json_metadata{"tags":["steemrepo"],"users":["nikema"],"app":"steemit/0.1"}
created2018-05-15 23:00:39
last_update2018-05-15 23:00:39
depth3
children0
last_payout2018-05-22 23:00:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length95
author_reputation124,324,143,886
root_title"How to Broadcast a Comment to a specific user link"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id55,903,592
net_rshares0