Skip to main content

Hey everyone, I’m following thishttps://developers.miro.com/docs/working-with-sticky-notes-and-tags-with-the-rest-api and after obtaining my oath for my app and plug that in the code, plus added the board id from https://miro.com/app/board/uXjXXXXXXXX/ where uXjXXXXXXXX(censored) is the board id and i get the following error:

const sticky = await board.createStickyNoteItem({
                           ^

TypeError: board.createStickyNoteItem is not a function

Complete code:

 

// Using miro-api client library
const { MiroApi, ShapeItem } = require("@mirohq/miro-api");

const api = new MiroApi('eyJtaXJvLm9yaWdpXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')

const board = api.getBoard('uXjXXXXXXXX')

async function main() {
const sticky = await board.createStickyNoteItem({
data: {
content: "I'm a sticky note",
shape: "square",
},
style: {
fillColor: "light_yellow",
textAlign: "center",
textAlignVertical: "top",
},
position: {
x: 0,
y: 0,
},
})
}
main()

 

 

I think the issue is with permissions or things like that but I’ve checked my team and app and it has write and read permissions for the team boards.

Any tip?
thanks

Hello Leonardo, 

Can you try to replace board.createStickyNoteItem({ with board.createStickyNote({

 

Please let me know if this solved your problem. Thanks and have a good one.

 

Cheers,

Mira


Hello Leonardo, 

 

I did some further checks on the issue you’re facing. I figured that  board.createStickyNoteItem is the correct method to use so can you please try to follow the sample code provided below and let me know if it works for you. 

const api = miro.as("");

const board = await api.getBoard("uXjVMZyMpg0=")  

const item = await board.createCardItem({

  data: { title: "sample card item" },

  position: { origin: "center", x: 0, y: 0 },

})

console.log(item)

 

In the earlier code you provided, you’re nesting the createStickyNoteItem method in a function, which could be part of the problem. You’re also missing await in front of the api.getBoard method.

Please let me know if this resolved the issue you’re facing. Thanks and have a good one. 

Cheers,

Mira

 

Reply