Using $send in a custom action

Hey,

Trying to use $send.sql() to log events from a custom action created using these docs: Quickstart: Action Development

However, I get $send is not defined when I run the action.

Any clues?

Thanks – Nick

@nickmason thanks for reaching out and I apologize for the delay.

I’m in the process of writing docs for this, but in component actions, you have access to $send functions within $.send (note the period), where $ is provided as a property of the parameter we pass to component actions:

async run({ $ }) {
  $.send.sql({
    table: "component_action_test",
    payload: {
      foo: "bar",
    },
  });
},

Let me know if that helps.

Worked perfectly, thanks @dylburger :+1:

Nick