{"id":17323957,"url":"https://github.com/strugee/node-send-webmention","last_synced_at":"2025-04-14T16:42:19.559Z","repository":{"id":41826837,"uuid":"111175863","full_name":"strugee/node-send-webmention","owner":"strugee","description":"Send a Webmention","archived":false,"fork":false,"pushed_at":"2024-01-10T06:53:16.000Z","size":628,"stargazers_count":7,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T05:56:10.629Z","etag":null,"topics":["hacktoberfest","indieweb","javascript","nodejs","npm-module","webmention"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/send-webmention","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/strugee.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-11-18T04:17:31.000Z","updated_at":"2023-11-10T22:56:46.000Z","dependencies_parsed_at":"2023-02-08T09:35:13.173Z","dependency_job_id":null,"html_url":"https://github.com/strugee/node-send-webmention","commit_stats":{"total_commits":58,"total_committers":4,"mean_commits":14.5,"dds":"0.10344827586206895","last_synced_commit":"7149b912e30227f11d3dbe9a254b2d2a0482c5e8"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strugee%2Fnode-send-webmention","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strugee%2Fnode-send-webmention/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strugee%2Fnode-send-webmention/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strugee%2Fnode-send-webmention/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/strugee","download_url":"https://codeload.github.com/strugee/node-send-webmention/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248918341,"owners_count":21183170,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","indieweb","javascript","nodejs","npm-module","webmention"],"created_at":"2024-10-15T14:09:41.184Z","updated_at":"2025-04-14T16:42:19.528Z","avatar_url":"https://github.com/strugee.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-send-webmention\n\n[![Build Status](https://travis-ci.org/strugee/node-send-webmention.svg?branch=master)](https://travis-ci.org/strugee/node-send-webmention)\n[![Coverage Status](https://coveralls.io/repos/github/strugee/node-send-webmention/badge.svg?branch=master)](https://coveralls.io/github/strugee/node-send-webmention?branch=master)\n[![Greenkeeper badge](https://badges.greenkeeper.io/strugee/node-send-webmention.svg)](https://greenkeeper.io/)\n\nSend a Webmention.\n\nOriginally written for similar reasons as [`get-webmention-url`][] - [`webmention-client`][] was way overcomplicated and seemed unmaintained.\n\nThis project is, however, API-compatible with @connrs' module.\n\n## Install\n\n```\nnpm install send-webmention\n```\n\n## Usage\n\nThis module is a drop-in replacement for [`webmention-client`] with the following exceptions:\n\n* It uses [`get-webmention-url`][] under the hood so it supports more discovery mechanisms (and has less bugs)\n* It considers any 2xx response to mean success, not just 202 Accepted\n* It returns the HTTP response object instead of trying to be clever with the body\n\nThe module exports a function with several forms:\n\n### `webmention(source, target[, userAgent], callback)`\n\n`source` (`String`): the source URL for the Webmention.\n\n`target` (`String`): the target URL to send the Webmention to.\n\n`userAgent` (`String`; optional): the value of the `User-Agent` header for all HTTP requests\n\n`callback` (`Function`): function that will be called when the Webmention has been sent. See \"callback return values\" below\n\n### `webmention(opts, callback)`\n\n`opts` (`Object`): options object with at least a `target` key and a `source` key, plus an optional `ua` key to set the `User-Agent`\n\n`callback` (`Function`): function that will be called when the Webmention has been sent. See \"callback return values\" below\n\n### Callback return values\n\nThe callback function will receive either an error as the first argument or an object as the second argument (never both).\n\nIf everything goes (mostly) okay, you'll get the object back. The object will have one or two keys, `success` (which is a `Boolean`) and `res` (which is an instance of `http.IncomingMessage` and is included only if the target had a Webmention endpoint that we POSTed to). `success` will be `true` if the Webmention was successfully delivered and the response used a 2xx status code. Otherwise it will be `false`.\n\nIf an error is encountered during processing (this mostly means HTTP errors), you'll get back an `Error` instead. Note that a page not having a Webmention endpoint or a non-2xx response will _not_ result in an `Error`, but they _will_ result in `success` being set to `false`.\n\n## Examples\n\n```js\nvar webmention = require('send-webmention'),\n    concat = require('concat-stream');\n\nwebmention('https://example.com/index.html', 'https://example.org/a_post', function(err, obj) {\n    if (err) throw err;\n\n    if (obj.success) {\n        obj.res.pipe(function(buf) {\n            console.log('Success! Got back response:', buf.toString());\n        });\n    } else {\n        console.log('Failure :(');\n    }\n});\n```\n\n```js\nvar webmention = require('send-webmention'),\n    concat = require('concat-stream');\n\nwebmention('https://example.com/index.html', 'https://example.org/a_post', 'webmention-5000/1.0.0', function(err, obj) {\n    // Same thing\n});\n```\n\n```js\nvar webmention = require('send-webmention'),\n    concat = require('concat-stream');\n\nwebmention({\n               source: 'https://example.com/index.html',\n               target: 'https://example.org/a_post'\n           },\n           function(err, obj) {\n               // Same thing\n           });\n```\n\n```js\nvar webmention = require('send-webmention'),\n    concat = require('concat-stream');\n\nwebmention({\n               source: 'https://example.com/index.html',\n               target: 'https://example.org/a_post',\n               ua: 'webmention-5000/1.0.0'\n           },\n           function(err, obj) {\n               // Same thing\n           });\n```\n\n## Security considerations\n\nThis module does absolutely nothing to address the Webmention spec's [security considerations section][]. You need to take care of this yourself.\n\n## Version support\n\nSupports Node 8+.\n\n## Author\n\nAJ Jordan \u003calex@strugee.net\u003e\n\n## License\n\nLesser GPL 3.0+\n\n [`get-webmention-url`]: https://github.com/strugee/node-get-webmention-url\n [`webmention-client`]: https://github.com/connrs/node-webmention-client\n [security considerations section]: https://www.w3.org/TR/webmention/#security-considerations\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrugee%2Fnode-send-webmention","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstrugee%2Fnode-send-webmention","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrugee%2Fnode-send-webmention/lists"}