Struggling with MQTT Publish

I’m a little lost with something basic. I need to publish the value of an input slider to an MQTT topic. I confused as to how to do this and how to get the actual value. I don’t know if I need a template or if there is some syntax I’m missing to create the payload.

What needs to be published is something like

{"setpoint":100}

where the 100 comes from the slider. In my automation I’ve tried different combinations of

payload: "setpoint" : input_number.spa_temperature_set_point

using quotes, single quotes. I’ve also tried

payload: "setpoint" : {{states('input_number.spa_temperature_set_point') | int }}

In all case, what gets published is just that entire string of text. I never get the numeric value.

Can someone point me in the right direction here?

Thanks!

If you need to publish proper JSON:

payload: '{ "setpoint" : {{ states("input_number.spa_temperature_set_point") }} }'

Thank you!!