[SOLVED] Passing text from Telegram command

I am trying to create a very simple flow that allows me to broadcast commands as TTS through my Google Home devices using Telegram .e.g. entering /say hello will result in my google home player saying “hello”

I have the following setup

[{"id":"d3f753fd78234fca","type":"telegram command","z":"f77852046b34a82c","name":"/say","command":"/say","bot":"f6f9f1e8.d14fc","strict":false,"hasresponse":true,"useregex":false,"removeregexcommand":false,"outputs":2,"x":270,"y":440,"wires":[["3bb45be3.a25fec"],[]]},{"id":"3bb45be3.a25fec","type":"api-call-service","z":"f77852046b34a82c","name":"Google say","server":"8e2273cf.db33f","version":3,"debugenabled":false,"service_domain":"tts","service":"google_say","entityId":"","data":"{\"entity_id\":\"media_player.photo_display\",\"message\":\"hi\",\"language\":\"en\"}","dataType":"json","mergecontext":"","mustacheAltTags":true,"outputProperties":[],"queue":"none","x":490,"y":440,"wires":[[]]},{"id":"f6f9f1e8.d14fc","type":"telegram bot","botname":"Baselmania_HASS","usernames":"","chatids":"-xxxxxxxxx","baseapiurl":"","updatemode":"polling","pollinterval":"300","usesocks":false,"sockshost":"","socksport":"6667","socksusername":"anonymous","sockspassword":"","bothost":"","botpath":"","localbotport":"8443","publicbotport":"8443","privatekey":"","certificate":"","useselfsignedcertificate":false,"sslterminated":false,"verboselogging":true},{"id":"8e2273cf.db33f","type":"server","name":"Home Assistant Sers","legacy":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]

Doing a debug I notice that “/say Hello there” produces the following playload:

{"chatId":-xxxxxxxxx,"messageId":478,"type":"message","content":" Hello there"}

Currently the data in my api-service-call is

{
    "entity_id": "media_player.photo_display",
    "message": "hi",
    "language": "en"
}

I need to replace the “hi” bit with the payload “content” but I am not sure of the syntax or how to write this.

So I worked it out

image

The functions properties are

msg = {payload: msg.payload.content};
return msg;

And the Google Say API

{
   "entity_id": "media_player.photo_display",
   "message": msg.payload,
   "language": "en"
}