How to make Queries and Post to a board in Monday.com from R? (with answer)

I had this question and I couldn’t find solutions here. So I decided to share the basics that I found.

I’ll asumme you already have your token.

First of all you need httr and jsonlite to handle queries and posts, and json responses.

Then, from the board you are interested, for example as the one in the image above, you need the id.


Then we need the id from each column (besides the item column), we use the following query

query <- '{
boards(ids: [7417519601]) {
name
columns {
  title
  id
  type
}
groups {
  title
  id
 }
}
}'

Then we send the POST (and I’ll assume the response is successful)

response <- POST(
  url = "https://api.monday.com/v2",
  add_headers(Authorization = apiKey),
  body = list(query = query),
  encode = "json"
)

After converting the response, we check the column types and their id’s

data <- content(response, as = "text")
data_json <- fromJSON(data, flatten = TRUE)
data_json$data$boards$columns |> as.data.frame() |> View()

Checking the queries in the API Playground is useful.


We also need the group id, which can be found with the query

query <- '
{
  boards (ids: 7417519601) {
    groups {
      id
      title
    }
  }
}
'

After the same response code and json handling as before, we check the group id

data_json$data$boards$groups |> as.data.frame() |> View()

Our group is called “Principal”, but it’s id is “topics”


Now we will post an item. Some types are initially tricky, so checking in the API Playground for existing items (I could add an example later if someone needs to) can be helpful too.

For this we need a mutation:

mutation <- sprintf('
mutation {
  create_item (
    board_id: 7417519601,
    group_id: "topics", 
    item_name: "An item 1",   #can be sent as parameter too
    column_values: "{
    \"text__1\":\"%s\", 
    \"numbers__1\":\"%d\",
    \"date4\":\"%s\",
    \"email__1\": {\"text\": \"%s\" , \"email\": \"%s\" },
    \"status\":{\"index\":%s}
    }") 
   {
    id
    name
  }
}
', "Neo", 42, "2024-09-11", "[email protected]", "[email protected]", 0
)

and its POST

response <- POST(
  url = "https://api.monday.com/v2",
  add_headers(Authorization = apiKey),
  body = list(query = mutation),
  encode = "json"
)

And here we have it

  • We could have sent only some of the values. In that case it will show empty in the item
  • Email needs two parameters: the actual email and the text of how it will appear in the item’s line. Here I’m sending the email twice,
  • Dates should be “YYYY-MM-DD”
  • Sometimes numbers can be sent as %s too, as long as is a number format (whereas a number or character variable), the column type will handle it as it is; And sometimes you’ll be forced to use %s because R will tell you to…
  • Status. Here we used {“index”:%s} and the 0 parameter that shows as “Dev” in the group. We could have also used {“label”:”%s”} and “Dev” as the parameter

If the query has a typo or something, the response will be successful, but it won’t reach the group.


Maybe this is too basic, but I wanna think there is someone out there that could use this as a start, even with chat-gpt around us.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật