Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
ifttt-wordpress-webhook
Advanced tools
IFTTT Wordpress Webhook is a tiny package that allows a node application to expose a webhook, that can be triggered by IFTTT. It basically wraps a xmlrpc server with basic configuration, that mimics a typical wordpress server and run custom code when the method newPost
is invoked by IFTTT.
Create a IFTTT receipe with Wordpress as an action ("then")
Run the following code in a public facing machine
var iftttWebHook = require('ifttt-wordpress-webhook');
iftttWebHook({user: {
name: 'foo',
password: 'bar'
},
webhook: function(data) {
// Do something
}
})
The idea here is to use some of the available fields in wordpress to define the service parameters. Let's assume the following:
Title
field will contain the method and the urlBody
field will contain the body to send to the serviceCategories
field will contain the headers nameTags
field will contain the headers valuesNote: The service url does not contain the protocol. The reason behind this is that IFTTT rewrites URLs contained in a receipe fields into a short url, i.e. http://ift.tt/3NrWPwT
. To prevent that, the protocol is manually happended before invoking the webhook. Currently only supports http
.
var request = require('request'),
_ = require('lodash'),
iftttWebHook = require('ifttt-wordpress-webhook');
/*
Example payload:
[ '',
'foo',
'bar',
{ title: 'PUT //my.server.com/my/endpoint',
description: '{"message":"test"}',
categories: [ 'X-Request-ID', 'User-Agent' ],
mt_keywords: [ '1234567890', 'ifttt-wordpress-webhook' ],
post_status: 'publish' },
true ]
*/
function webhook (data) {
console.log ('webhook invoked with following data:', data);
// Map fields
var cache1 = data.title.split(' ');
var options = {
method: cache1[0],
url: 'http:' + cache1[1], // See note above
headers: _.zipObject(data.categories, data.mt_keywords),
json: JSON.parse(data.description)
};
/* options equals to
{ method: 'PUT',
url: 'http://my.server.com/my/endpoint',
headers:
{ 'X-Request-ID': '1234567890',
'User-Agent': 'ifttt-wordpress-webhook' },
json: { message: 'Test' } }
*/
request(options);
}
var params = {
user: {
name: 'foo',
password: 'bar'
},
webhook: webhook
};
server = iftttWebHook(params);
Type: Object
Mandatory. Need to match the user and password filled out in the Wordpress Channel in IFTTT.
Type: Function
Mandatory. Function to invoke when the webhook is triggered.
Type: Object
Default: {host: 'localhost', path: '/xmlrpc.php', port: 80}
Specify XMLRPC server configuration that IFTTT service hits.
$ npm run build
FAQs
Webhook for IFTTT using wordpress channel.
We found that ifttt-wordpress-webhook demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.