webmention-client

A client to ping webmention servers

Webmention Client

A simple client to ping a WebMention service.

var webmention = require('webmention-client');
var source = 'http://example.org/blog/my-latest-blog-post';
var target = 'http://example.com/blog/interesting-blog-post-i-want-to-link-to';

function webmentionComplete(err, response) {
  if (err) {
    // Handle error
    console.log(err, response);
  }
  else {
    // woot
    console.log(response);
  }
}

webmention(source, target, webmentionComplete);
webmention(sourceUrl, targetUrl, callback);

The sourceUrl is your URL, a blog post or article, that contains a link to the targetUrl at another location. The callback parameter is a callback function that is called:

callback(err, result);

The err parameter is any potential error encountered during the HTTP request.

The result parameter is an object containing a success boolean and a response object. If the response is JSON, this will be available as the response object; if the response is blank or non-JSON, it will be available as response.raw instead. For further information, see the WebMention specification.