Receive Concatenated SMS from Nexmo

A flow to handle SMS messages sent via Nexmo and in particular multipart SMS where the message is longer than 160 chars.

This flow will reconstruct a single message from the multiple message parts nexmo sends to your webhook.

The output will be the same as a single part message however the Keyword and MessageID params will be missing, although these are not requrired for most scenarios with multipart SMS.

The flow also handles regular single part SMS messages and passes those through, see the debug nodes for the 2 output points

[{"id":"f79df78d.bba14","type":"http in","z":"eda6b86c.927c8","name":"","url":"/inbound-sms","method":"get","upload":false,"swaggerDoc":"","x":330,"y":440,"wires":[["3581dabb.88860e","37c83ca9.3dc8fc"]]},{"id":"3581dabb.88860e","type":"http response","z":"eda6b86c.927c8","name":"Send 200 Response","statusCode":"","headers":{},"x":400,"y":500,"wires":[]},{"id":"f4a52f62.efff78","type":"debug","z":"eda6b86c.927c8","name":"Reconsituted Multipart SMS","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1540,"y":280,"wires":[]},{"id":"7d90fedd.36a2f8","type":"join","z":"eda6b86c.927c8","name":"","mode":"auto","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1070,"y":280,"wires":[["549c4b25.a55174"]]},{"id":"56253316.96dcac","type":"change","z":"eda6b86c.927c8","name":"","rules":[{"t":"set","p":"parts.id","pt":"msg","to":"payload.concat-ref","tot":"msg"},{"t":"set","p":"parts.index","pt":"msg","to":"payload.concat-part","tot":"msg"},{"t":"set","p":"parts.count","pt":"msg","to":"payload.concat-total","tot":"msg"},{"t":"set","p":"msisdn","pt":"msg","to":"payload.msisdn","tot":"msg"},{"t":"set","p":"to","pt":"msg","to":"payload.to","tot":"msg"},{"t":"set","p":"type","pt":"msg","to":"payload.type","tot":"msg"},{"t":"set","p":"parts.type","pt":"msg","to":"string","tot":"str"},{"t":"set","p":"parts.ch","pt":"msg","to":"","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"payload.text","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":280,"wires":[["7d90fedd.36a2f8"]]},{"id":"6f9a0950.6e4098","type":"debug","z":"eda6b86c.927c8","name":"Single SMS","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":990,"y":440,"wires":[]},{"id":"37c83ca9.3dc8fc","type":"switch","z":"eda6b86c.927c8","name":"Is Concat?","property":"payload.concat","propertyType":"msg","rules":[{"t":"istype","v":"string","vt":"string"},{"t":"istype","v":"undefined","vt":"undefined"}],"checkall":"true","repair":false,"outputs":2,"x":610,"y":440,"wires":[["56253316.96dcac"],["6f9a0950.6e4098"]]},{"id":"549c4b25.a55174","type":"change","z":"eda6b86c.927c8","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload.text","tot":"msg"},{"t":"move","p":"msisdn","pt":"msg","to":"payload.msisdn","tot":"msg"},{"t":"move","p":"to","pt":"msg","to":"payload.to","tot":"msg"},{"t":"move","p":"type","pt":"msg","to":"payload.type","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1260,"y":280,"wires":[["f4a52f62.efff78"]]}]

Flow Info

Created 2 years, 7 months ago
Rating: not yet rated

Owner

Node Types

Core
  • change (x2)
  • debug (x2)
  • http in (x1)
  • http response (x1)
  • join (x1)
  • switch (x1)

Tags

  • nexmo
  • sms
  • multipart
  • concatenated
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option