Handling Incoming Webhooks in PHP

An increasing number of applications now offer webhooks as an integration, often in addition to an API. The classic example, familiar to most developers, is the GitHub webhooks which can notify your other systems such as CI tooling that a new commit has been added to a branch. If you imagine how many repositories exist on GitHub, and how many other systems react to changes on each repository … there’s a reason they are excellent with webhooks! Whether it’s your source control, updates from your IoT sensors, or an event coming from another component in your application, I have some Opinions (TM) about handling webhooks, so I thought I’d write them down and include some code as well, since I think this is an area that many applications will need to work with. Continue reading

HTTP Tools Roundup

At a conference a few days ago, I put up a slide with a few of my favourite tools on it. I got some brilliant additional recommendations in return from twitter so I thought I’d collect them all in one place in case anyone is interested – all these tools are excellent for anyone working APIs (so that’s everyone!). First, my original slide:

Continue reading

Deploying OpenWhisk Actions With Dependencies

I mostly use OpenWhisk with NodeJS (which is lucky for me, it’s the best supported of the languages and default for the documentation examples!) and while there are a bunch of npm modules already installed on OpenWhisk, sometimes there will be others that you also want to include. Alternatively or additionally, you might also want to deploy your package.json since this can specify the entry point if it’s not index.js which is the default.

Continue reading

Building Conversations With Alexa

Having an Amazon Echo Dot in my office is quite fun, and I’ve accidentally started writing more skills and giving a few talks about building skills for the Alexa toolchain. Today I created a skill that uses multiple steps to make a conversation and thought I’d better write down what I did so I’d be able to remember!

The basic idea is that when creating the “intent”, i.e. the action that you want Alexa to do, you also define “slots”. The slots are the variables; if this were a command line tool, they’d be the arguments you typed. It’s possible to include both intent and slots in your wording when you speak to Alexa, but equally you can just invoke the skill and have it prompt you for the rest of the information. Continue reading

Package Parameters in OpenWhisk

I love OpenWhisk but I struggled a little to get the parameters attached in a sane way for a while so I am capturing my notes here for future reference! Parameters can be attached to actions or packages; I tend to break my actions down really small and pass data into them, while preferring to set parameters on the package that the actions belong to. Continue reading

Where was that GitHub Discussion?

Did GitHub change their activity feed? Or am I getting more confused now I contribute to so many different projects that I’m not a maintainer of? Either way, I struggle sometimes to find the pull request or issue that I had a discussion on to revisit or continue that discussion (yes, I get email notifications – and no, I don’t take good enough care of them to find things that way).

GitHub has brilliant advanced search functionality, and what I wanted was:

is:pr commenter:lornajane sort:updated-desc

Which gives me a list of all the pull requests I’ve commented on, with the most recent first. I couldn’t remember the exact repo name and I also often switch is:pr for is:issue as appropriate, but this search string has been very helpful for finding those odd things you want to follow up on.

Do you have a favourite GitHub search string combination? Would you care to share it in the comments? Thanks :)

Multiple Search Keys in CouchDB

I work quite a bit with CouchDB (Cloudant, a hosted CouchDB solution, is part of Bluemix, IBM’s cloud platform – and I work for IBM so I get to use this as much as I like) and today I found a feature I hadn’t seen before. I struggled to find the docs, so I thought I’d post my working example here in case anyone else is solving a similar problem: wanting to use more than one set of key ranges when filtering a CouchDB view. Continue reading

One OpenWhisk Action Calls Another

Working with openwhisk, it’s easy to create many isolated actions and build them up into sequences; the output of one action is passed to the next action in the sequence. In my case, I wanted one action to spawn potentially many other actions. I had to look up how to do it and here it is so I can look it up more quickly next time! Continue reading

Alexa Project Name Generator on OpenWhisk

I’m having lots of fun with my Amazon echo and echo dots, creating skills for them. Initially I used Amazon’s lambda platform since that’s a very easy way to get started – but I’m an advocate for IBM and was looking for an excuse to play with OpenWhisk (an open source serverless offering that Bluemix has a hosted version of) anyway so this was a great opportunity!

Configuring Skills

There are a bunch of good resources around for setting up skills, picking the name, configuring the “invocation” which is what to say to make the code happen, and so on. I’ll skip this section and instead just share a couple of tutorials that I rely on a lot:

Once your skill is configured, it’s time to write the code (note: UK users need to pick English (UK) and not English (US) as otherwise your skill will mysteriously fail in your home region. Guess how I learned that??) Continue reading

Working With Sorted Sets in Redis

I work with a bunch of datastores and I probably shouldn’t have favourites – but if I did, Redis would be one of them! I used the sorted sets in something I was building and remembered how much I liked the feature so here’s a quick primer on what it is and when it can be handy. Continue reading