I'm using POST from the httr package to send messages through a discord bot as large scripts update, and I'd like to make these messages a little more complicated than they currently are.
My problem is that the following messages just return the same single word "try".
library(httr)
POST(url = "<mywebhook>",
body = list(content = "try"),
encode = "json")
POST(url = "<mywebhook>",
body = list(content = "try",
embed = list(title = "this is a title",
ThumbnailUrl = "<someimage.png>")),
encode = "json")
My rough understanding is that i can mimic the json format through a series of nested lists for the embed, but that doesn't seem to be true.
Ideally I'd like to set up the embed such that I can send updated plots to a server while something is running, or programmatically generated text strings to provide information about a script's activity.
This is a typo mistake. Proper element is embeds
no embed
, and it is array of objects so in R it should be list of lists:
POST(
url = "<mywebhook>"
,body = list(
content = "try"
,embeds = list(
list(
title = "this is a title"
,ThumbnailUrl = "<someimage.png>"
)
)
)
,encode = "json"
)