Passing msg attributes with Node Red

I’m attempting to send a Slack notification when a calendar sensor has been triggered, but I can’t for the life of me figure out how to get the attribute into the Slack message. I can access it using a debug node and msg.data.new_state.attributes.description, but Node Red doesn’t like the following in the message field: { "message": msg.data.new_state.attributes.description }.

Any suggestions where I’m going wrong?

Did you figure this out? Im trying to get an attribute into a notification in node red as well.

Its an old question, but in case somebody else is wondering. I found it works using the function node and JS.

msg.payload = { data: {'message': msg.data.new_state.attributes.description  } };
return msg;

In the slack service call simply put {} in the data field.

1 Like