I have the following unit file:
[Unit]
Description=Sends a message to a discord channel
[Service]
Type=oneshot
ExecStart=curl --header "Content-Type: application/json" --request POST --data '{"content":"MESSAGE TEXT HERE"}' https://discord.com/api/webhooks/WEBHOOK_ID_HERE/WEBHOOK_TOKEN_HERE
DynamicUser=yes
# No [Install] since this is meant to be used with a timer
Running the curl command that is in ExecStart manually posts the message to the Discord channel that corresponds to this webhook, while starting the service produces the response {"code": 50109, "message": "The request body contains invalid JSON."}
from the Discord server.
Is there any notable difference between running a command through systemd and directly? For example, I could not find any indication that there might be a maximum command length for ExecStart.