Course 1 syntax for Discord post text didn't work for me right away

Describe the problem/error/question

With the Discord node, the text that is described in Course 1 didn’t work for me:

I needed to rewrite it before the values were parsed correctly:
This week we have {{ $json.totalBooked }} booked orders with a total value of {{ $json.bookedSum }}. My Unique ID: {{ $(‘HTTP Request’).params[“headerParameters”][“parameters”][0][“value”] }}

What is the error message (if any)?

none, the node showed Sucess True as a result no matter what.

Please share your workflow

{
“meta”: {
“instanceId”: “a18bf26e966bc5c9e62af2047fa0d0a2e509365c7026b205f585c41ef8dd5ec6”
},
“nodes”: [
{
“parameters”: {
“webhookUri”: “=https://discord.com/api/webhooks/1175601599922569326/-iSK55b643h9MSPc8gB1UNq_1czypSOZouz-b6ZH0ztwJkOoQJwfxdpbreBFwPu97V5f”,
“text”: “=This week we have {{ $json.totalBooked }} booked orders with a total value of {{ $json.bookedSum }}. My Unique ID: {{ $(‘HTTP Request’).params["headerParameters"]["parameters"][0]["value"] }}”,
“options”: {}
},
“id”: “c7f15f73-fb12-432e-a77a-374b67c4d248”,
“name”: “Discord”,
“type”: “n8n-nodes-base.discord”,
“typeVersion”: 1,
“position”: [
1400,
420
],
“notesInFlow”: true,
“notes”: “This week we have {{ $json.totalBooked }} booked orders with a total value of {{ $json.bookedSum }}. My Unique ID: {{ $(‘HTTP Request’).params["headerParameters"]["parameters"][0]["value"] }}”
}
],
“connections”: {}
}

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

[this showed up as a result in my Discord]
This week we have {{$json[“totalBooked”]}} booked orders with a total value of {{$json[“bookedSum”]}}. My Unique ID: {{ $(‘HTTP Request’).params[“headerParameters”][“parameters”][0][“value”] }}

Expected: This week we have 16 booked orders with a total value of 2251.14. My Unique ID: e4d19d59382159d8c17bf089fb7e910f

The instructions used from Course 1 caused the first output. I corrected it by altering the syntax of the JSON variable calls. I posit that Course 1 needs some updating.

  1. [8:59 PM]

Information on your n8n setup

  • n8n version:1.16.0
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):?
  • Running n8n via Docker
  • Operating system: default with Docker: linux variant

Hey @norg welcome to the community! Sorry to hear you ran into a few issues getting this to work initially but thanks for reporting this and for your feedback on other threads. Really useful in helping us to tweak and improve things on the course.

Having double checked, technically speaking both expression formats you mentioned should work. What isn’t particularly clear in the course is that the ‘content’ field on the discord node defaults to ‘text’ even if an expression is pasted in. I wonder if it’s possible that when the first expression was used it was still set as ‘text’ rather than an expression?

Alternatively, the only other thing I noticed copying in your expressions above to test, is that some have curly quotations (which might just be once they were pasted into the forum) which also may cause them to output as text.

e.g {{$json[“bookedSum”]}} (curly quotes) vs {{$json["totalBooked"]}} (straight quotes).

Either way, I can already see some improvements we can add to make this clearer going forwards, so we’ll certainly take a look at that shortly. Please do let us know though if any of the above gets both these formats working for you.

3 Likes

That’s very possible it wasn’t treating the vars right. and posting them as the placeholders. I did get the post to work correctly by pointing it at my test Discord channel.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.