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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sinch/node-red-conversation-api

v1.0.3

Published

Package of Sinch messaging nodes for Node-RED

Downloads

6

Readme

@sinch/node-red-conversation-api

A package of nodes for Node-RED which allows you to connect, send and receive messages through the Sinch Conversation API. For more information about the Sinch Conversation API, which messaging channels it supports and how to get started, see the documentation.

Sinch Conversation API

Installation

The first step is to install Node-RED.

$ sudo npm install -g node-red

Compatible with Node-Red version 3.x.x and later

The second step is to install the package. You can either install it directly using the Palette Manager. Instructions can be found here: Node-RED.

Or install manually using npm:

Navigate to the Node-RED installation and install the package:

$ cd ~/.node-red
$ npm install @sinch/node-red-conversation-api

Run Node-RED locally:

$ node-red

This will start a server for Node-RED on http://127.0.0.1:1880/.

If the installation of the node package was successful, the Sinch Messaging nodes should be available in the node palette to the left, under the category "Sinch Messaging".

Get started

After you've installed Node-RED and the @sinch/node-red-conversation-api package you can start building your flow. To get you started we provide an example flows.json containing the essentials for sending and receiving messages. To import the flows.json file, open Node-RED in the browser and select the hamburger menu in the top right corner. Choose "Import" and press "select a file to import". The flow file will then be imported on a tab called "Example flow".

The flow.json contains three separate example flows. For each of the flows there exists a comment node containing additional information about the configuration required to test it out.

Testing

If you're running Node-RED locally on localhost and want to test receiving messages and events, we recommend using a tool like Ngrok. This tool allow you to expose your localhost to the internet and makes it possible to route callback events to Node-RED. This is also a useful for testing the native Http-in node provided by Node-RED.

More about the nodes

This package contains the following six nodes:

Receive message node

Handles incoming messages. Requires a Conversation API configuration. In most cases the same Conversation API configuration can be reused in the Send and Template nodes.

Events node

Handles all event triggers that has been configured on the App selected in the Conversation API configuration. One or more events can be selected in the configuration and multiple Events nodes can be configured to listen for the same event.

Message node

The Message node only defines the message to be sent using the Conversation API. It is often connected to a send node which actually sends the message. The message is configured as a JSON in the format specified in the Conversation API documentation.

Template node

The Template node only specifies a template to be sent using the Conversation API. It is often connected to a send node which actually sends the message. Templates are created and edited on the Sinch Dashboard.

Send node

Sends a message that has been configured either in a upstream Message or Template node. It also accepts a message or templateId to be passed on the msg object. The recipient for the message can be specified in three ways:

  1. Automatically set if a Receive message node is connected upstream in the flow
  2. Automatically set if a Start conversation node is connected upstream in the flow
  3. Can me set manually by passing a contact on the msg object.
msg.contact = { channelIdentities : { channel: "SMS", identity: "+123123123" } }

If the "Await response" is checked the flow will continue when a response arrives from the recipient. Otherwise the flow will continue after the message is sent. If the message fails, the flow will continue from the second output.

Start conversation node

Allows easy configuration of the recipient of the message(s) to be sent and variables. The recipient is specified by providing one or more channels and identities. For some channels, such as SMS, WhatsApp and RCS, the identities are phone numbers. The variables can be used if defined in a Message or template node. They are also stored in the conversation API and available throughout the flow on the msg object.

Contributing

See, CONTRIBUTING.md.

Copyright and license

Copyright Sinch AB, https://sinch.com under the Apache 2.0 license.