npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@relaypro/sdk

v2.4.0

Published

Workflow SDK Relay on Node.js

Readme

relay-js

relay-js SDK is a Node.js library for interacting with Relay. For full documentation visit developer.relaypro.com.

Installation

npm install @relaypro/sdk

Usage

The following code snippet demonstrates a very simple "Hello World" workflow. However, it does show some of the power that is available through the Relay SDK.

import pkg from '@relaypro/sdk'
const { relay, Event, createWorkflow, Uri } = pkg

const app = relay()

app.workflow(`helloworld`, helloworld)

const helloworld = createWorkflow(wf => {
  wf.on(Event.START, async (event) => {
    const { trigger: { args: { source_uri } } } = event
    wf.startInteraction([source_uri], `hello world`)
  })

  wf.on(Event.INTERACTION_STARTED, async ({ source_uri }) => {
    const deviceName = Uri.parseDeviceName(source_uri)
    console.log(`interaction start ${source_uri}`)
    await wf.sayAndWait(source_uri, `What is your name ?`)
    const { text: userProvidedName } = await wf.listen(source_uri)
    const greeting = await wf.getVar(`greeting`)
    await wf.sayAndWait(source_uri, `${greeting} ${userProvidedName}! You are currently using ${deviceName}`)
    await wf.terminate()
  })
})

Features demonstrated here:

  • When the workflow is triggered, the start event is emitted and the registered start callback function is called.
  • An interaction is started. This creates a temporary channel on the Relay device, which provides a sort of "context" in which some device-specific commands are sent.
  • Inside the interaction started handler, the workflow prompts with the sayAndWait action. The device user will hear text-to-speech.
  • The workflow awaits for a response from the device user with the listen action.
  • A workflow configuration variable greeting is retrieved as is the triggering device's name.
  • The workflow then again uses text-to-speech to reply with a dynamic message.
  • Finally, the workflow is terminated and the device is returned to its original state.

Using the Relay CLI, the workflow can be registered with the following command:

relay workflow:create:phrase --name my-test-workflow --uri wss://yourhost:port/helloworld --trigger test -i 99000XXXXXXXXXX

In the above sample sample, a workflow callback function is registered with the name helloworld. This value of helloworld is used to map a WebSocket connection at the path wss://yourhost:port/helloworld to the registered workflow callback function.

It is also possible to register a "default" workflow at path / by providing the workflow callback function as the first parameter:

app.workflow(wf => {
  wf.on(Event.START, async () => {
    // handle start event
  })
})

API

The Relay JS SDK covers a broad set of use cases. Explore the various actions that can be performed in workflow event callbacks:

The full API reference is available at https://relaypro.github.io/relay-js .

Workflow Registration

More thorough documentation on how to register your workflow on a Relay device can be found at https://developer.relaypro.com/docs/register-workflows

Development

git clone [email protected]:relaypro/relay-js.git
cd relay-js
npm install
npm run build
npm run test

License

MIT