Skip to main content

Create a pulse with column values

  • February 16, 2020
  • 11 replies
  • 5830 views

Hi, I’m trying to create a pulse via Node.JS with axios. I started with the example that is on this forum and edited it for my needs but I can’t get my code to add the column values for the pulse. What am I doing wrong?

// Packages
const axios = require("axios"),
    fs = require("fs");

// Files
const config = require("../config.json")

// Code
const body = {
    title: "Test bug",
    culprit: "util/testers/monday.js"
}
const current = new Date()
let month = current.getMonth() + 1
if (month < 10) {
    month = `0${current.getMonth() + 1}`
}

const axiosBody = {
    query: `
                    mutation ($boardId: Int!, $groupId: String!, $itemName: String!, $columnValues: JSON) {
                    create_item (
                        board_id: $boardId,
                        group_id: $groupId,
                        item_name: $itemName,
                        column_values: $columnValues
                    ) {
                        id
                    }
                    }
                `,
    variables: {
        boardId: BOARDID,
        groupId: "topics",
        itemName: `${body.title} from ${body.culprit}`,
        columnsValues: JSON.stringify({ status9: { index: 6 }, status: { index: 6 }, due_date: { date: `${current.getFullYear()}-${month}-${current.getDate()}` } })
    }
}

axios.post(`https://api.monday.com/v2`, axiosBody, {
    headers: {
        Authorization: config.prod.monday.apitoken
    }
})
    .catch(err => {
        console.error(err.data)
        //fs.writeFileSync("./mondayerror.txt", JSON.stringify(err.data))
    })
    .then(res => {
        console.log(res.data)
        fs.writeFileSync("./mondayerror.txt", JSON.stringify(res.data, null, 4))
    })
This topic has been closed for replies.

11 replies

  • Author
  • Participating Frequently
  • February 19, 2020

Bump. Could anyone help?


dipro
Forum|alt.badge.img
  • Leader
  • February 20, 2020

Hey @GameMaster2030 – what’s going wrong? Are you getting an error code, or is the item being created with no column values?


  • Author
  • Participating Frequently
  • February 20, 2020

Hi,
It’s being created with no column values.


dipro
Forum|alt.badge.img
  • Leader
  • February 20, 2020

Can you print the body of your request so we can dig into exactly what’s being passed?

The programming pattern looks right, but I’m sure there’s something subtle that we’re missing 🙂


  • Author
  • Participating Frequently
  • February 21, 2020

This is the full response:

{ status: 200,
  statusText: 'OK',
  headers:
   { date: 'Fri, 21 Feb 2020 12:54:28 GMT',
     'content-type': 'application/json; charset=utf-8',
     'transfer-encoding': 'chunked',
     connection: 'close',
     'set-cookie':
      [ '__cfduid=db4245be87854a2183c78cb8b92d83c5a1582289667; expires=Sun, 22-Mar-20 12:54:27 GMT; path=/; domain=.monday.com; HttpOnly; SameSite=Lax; Secure' ],
     status: '200 OK',
     vary: 'Origin',
     etag: 'W/"70921335031fd06971ad937f0c6141bb"',
     'cache-control': 'max-age=0, private, must-revalidate',
     'x-request-id': '806c7705-72f7-4607-8d8b-ef9d5e08196a',
     'x-runtime': '0.151127',
     'x-xss-protection': '1; mode=block',
     'content-security-policy': 'frame-ancestors https://bigbrain.me *.bigbrain.me *.dapulse.com *.dapulse.dev *.realize.io *.mondaystaging.com *.itsmonday.com *.monday.sh *.monday.com https://realize.io https://dapulse.com https://mondaystaging.com https://itsmonday.com https://monday.com https://monday.sh; script-src \\'self\\' \\'unsafe-inline\\' \\'unsafe-eval\\' http://localhost:8080 https://cdn.simpo.io/builder/builder.js *.lvh.me:* https://realize.io https://dapulse.com https://mondaystaging.com https://api-gw.mondaystaging.com https://itsmonday.com https://monday.com https://monday.sh https://api-gw.monday.com https://assets.zendesk.com https://*.intercom.io https://js.intercomcdn.com https://cdn.actionbar.io https://www.dropbox.com https://apis.google.com https://www.google.com bat.bing.com https://ct.capterra.com https://www.getapp.com https://widgets.outbrain.com https://cdn.taboola.com https://www.gstatic.com https://ssl.google-analytics.com https://apis.google.com/js/api.js https://code.highcharts.com https://maps.googleapis.com https://cdn.simpo.io/actionbar.js https://ajax.googleapis.com https://*.zopim.com ipinfo.io https://cdn.broadcast.am/assets/track_app.js code.jquery.com https://api.embed.ly/1/oembed https://api.embed.ly/1/extract https://bam.nr-data.net https://includestest.ccdc02.com/cardinalcruise/v1 https://gateway.bluesnap.com https://ws.bluesnap.com https://sandbox.bluesnap.com https://songbird.cardinalcommerce.com https://songbirdstag.cardinalcommerce.com https://js-agent.newrelic.com https://connect.facebook.net https://cdn.actionbar.io/actionbar.js https://googleads.g.doubleclick.net rum-static.pingdom.net/pa-574eda16abe53d4f2483c888.js https://fullstory.com https://www.fullstory.com https://cdn.monday.com https://cdn2.monday.com https://cdn1.monday.com https://cdn2.monday.com https://cdn.mondaystaging.com https://cdn2.mondaystaging.com https://assets.itsmonday.com https://cdnjs.cloudflare.com *.cloudfront.net https://*.pusher.com https://secure.quantserve.com/quant.js https://rules.quantcount.com https://ahrefs.com/toolbar/script.js d2c7xlmseob604.cloudfront.net/tracker.min.js https://s3.amazonaws.com https://www.googleadservices.com https://www.googletagmanager.com https://api.microsofttranslator.com sax.peakonspot.com/pops/wgprtb.php https://cdncache-a.akamaihd.net https://www.google-analytics.com https://quantcast.mgr.consensu.org/qcu.js https://translate.googleapis.com secure.shoppytoolmac.com/servicejs/components https://1049434604.rsc.cdn77.org/ij1.min.js tpc.googlesyndication.com/sodar/1s9mPOHO.js https://data1.nedmaf.com https://cdn.walkme.com https://data1.eurosty.com https://s.dcbap.com qdatasales.com/scripts/Pt8cY8Qvgbs5.js https://includestest.ccdc02.com *.map2.ssl.hwcdn.net cdn.mxpnl.com www2.redgit.pw/ex/scr https://m59.prod2016.com https://static.zdassets.com https://clou.im/cache.php s.mapitquick.net https://gist.github.com srdrvp.com/com ww1.ridiwo.space/oj/ij1 static.cmptch.com/v/lib/s.js https://data1.myloap.com/assets/js/jquery.js https://pwm-image.trendmicro.com https://e2b8u3v8.map2.ssl.hwcdn.net https://secure.myshopcouponmac.com https://urlvalidation.com https://data1.carazouco.com/assets/js/jquery.js https://analyticspage.tools https://eluxer.net https://loadsource.org https://ydpi.pw/addons https://accounts.google.com https://docs.google.com https://app.box.com https://webhooks.monday.com https://cdn7.mondaystaging.com https://cdn7.monday.com https://cdn.itsmonday.com https://cdn.monday.sh https://d2c7xlmseob604.cloudfront.net/tracker.min.js https://js.live.net https://snippet.growsumo.com/growsumo.min.js; worker-src \\'self\\' \\'unsafe-inline\\' blob:',
     'cf-cache-status': 'DYNAMIC',
     'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
     server: 'cloudflare',
     'cf-ray': '5688de77da3272f3-AMS' },
  config:
   { url: 'https://api.monday.com/v2',
     method: 'post',
     data: '{"query":"\\\\n                    mutation ($boardId: Int!, $groupId: String!, $itemName: String!, $columnValues: JSON) {\\\\n                    create_item (\\\\n                        board_id: $boardId,\\\\n                        group_id: $groupId,\\\\n                        item_name: $itemName,\\\\n                        column_values: $columnValues\\\\n                    ) {\\\\n                        id\\\\n                    }\\\\n                    }\\\\n                ","variables":{"boardId":380644130,"groupId":"topics","itemName":"Test bug from util/testers/monday.js","columnsValues":"{\\\\"status9\\\\":{\\\\"index\\\\":6},\\\\"status\\\\":{\\\\"index\\\\":6},\\\\"due_date\\\\":{\\\\"date\\\\":\\\\"2020-02-21\\\\"}}"}}',
     headers:
      { Accept: 'application/json, text/plain, */*',
        'Content-Type': 'application/json;charset=utf-8',
        Authorization: 'REMOVED',
        'User-Agent': 'axios/0.19.1',
        'Content-Length': 677 },
     transformRequest: [ [Function: transformRequest] ],
     transformResponse: [ [Function: transformResponse] ],
     timeout: 0,
     adapter: [Function: httpAdapter],
     xsrfCookieName: 'XSRF-TOKEN',
     xsrfHeaderName: 'X-XSRF-TOKEN',
     maxContentLength: -1,
     validateStatus: [Function: validateStatus] },
  request:
   ClientRequest {
     domain: null,
     _events:
      { socket: [Function],
        abort: [Function],
        aborted: [Function],
        error: [Function],
        timeout: [Function],
        prefinish: [Function: requestOnPrefinish] },
     _eventsCount: 6,
     _maxListeners: undefined,
     output: [],
     outputEncodings: [],
     outputCallbacks: [],
     outputSize: 0,
     writable: true,
     _last: true,
     upgrading: false,
     chunkedEncoding: false,
     shouldKeepAlive: false,
     useChunkedEncodingByDefault: true,
     sendDate: false,
     _removedConnection: false,
     _removedContLen: false,
     _removedTE: false,
     _contentLength: null,
     _hasBody: true,
     _trailer: '',
     finished: true,
     _headerSent: true,
     socket:
      TLSSocket {
        _tlsOptions: [Object],
        _secureEstablished: true,
        _securePending: false,
        _newSessionPending: false,
        _controlReleased: true,
        _SNICallback: null,
        servername: null,
        npnProtocol: false,
        alpnProtocol: false,
        authorized: true,
        authorizationError: null,
        encrypted: true,
        _events: [Object],
        _eventsCount: 9,
        connecting: false,
        _hadError: false,
        _handle: null,
        _parent: null,
        _host: 'api.monday.com',
        _readableState: [Object],
        readable: false,
        domain: null,
        _maxListeners: undefined,
        _writableState: [Object],
        writable: false,
        allowHalfOpen: false,
        _bytesDispatched: 1064,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: undefined,
        _server: null,
        ssl: null,
        _requestCert: true,
        _rejectUnauthorized: true,
        parser: null,
        _httpMessage: [Circular],
        read: [Function],
        _consuming: true,
        _idleNext: null,
        _idlePrev: null,
        _idleTimeout: -1,
        [Symbol(asyncId)]: 7,
        [Symbol(bytesRead)]: 4446 },
     connection:
      TLSSocket {
        _tlsOptions: [Object],
        _secureEstablished: true,
        _securePending: false,
        _newSessionPending: false,
        _controlReleased: true,
        _SNICallback: null,
        servername: null,
        npnProtocol: false,
        alpnProtocol: false,
        authorized: true,
        authorizationError: null,
        encrypted: true,
        _events: [Object],
        _eventsCount: 9,
        connecting: false,
        _hadError: false,
        _handle: null,
        _parent: null,
        _host: 'api.monday.com',
        _readableState: [Object],
        readable: false,
        domain: null,
        _maxListeners: undefined,
        _writableState: [Object],
        writable: false,
        allowHalfOpen: false,
        _bytesDispatched: 1064,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: undefined,
        _server: null,
        ssl: null,
        _requestCert: true,
        _rejectUnauthorized: true,
        parser: null,
        _httpMessage: [Circular],
        read: [Function],
        _consuming: true,
        _idleNext: null,
        _idlePrev: null,
        _idleTimeout: -1,
        [Symbol(asyncId)]: 7,
        [Symbol(bytesRead)]: 4446 },
     _header: 'POST /v2 HTTP/1.1\\r\\nAccept: application/json, text/plain, */*\\r\\nContent-Type: application/json;charset=utf-8\\r\\nAuthorization: **REMOVED**\\r\\nUser-Agent: axios/0.19.1\\r\\nContent-Length: 677\\r\\nHost: api.monday.com\\r\\nConnection: close\\r\\n\\r\\n',
     _onPendingData: [Function: noopPendingOutput],
     agent:
      Agent {
        domain: null,
        _events: [Object],
        _eventsCount: 1,
        _maxListeners: undefined,
        defaultPort: 443,
        protocol: 'https:',
        options: [Object],
        requests: {},
        sockets: [Object],
        freeSockets: {},
        keepAliveMsecs: 1000,
        keepAlive: false,
        maxSockets: Infinity,
        maxFreeSockets: 256,
        maxCachedSessions: 100,
        _sessionCache: [Object] },
     socketPath: undefined,
     timeout: undefined,
     method: 'POST',
     path: '/v2',
     _ended: true,
     res:
      IncomingMessage {
        _readableState: [Object],
        readable: false,
        domain: null,
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: undefined,
        socket: [Object],
        connection: [Object],
        httpVersionMajor: 1,
        httpVersionMinor: 1,
        httpVersion: '1.1',
        complete: true,
        headers: [Object],
        rawHeaders: [Array],
        trailers: {},
        rawTrailers: [],
        upgrade: false,
        url: '',
        method: null,
        statusCode: 200,
        statusMessage: 'OK',
        client: [Object],
        _consuming: true,
        _dumped: false,
        req: [Circular],
        responseUrl: 'https://api.monday.com/v2',
        redirects: [],
        read: [Function] },
     aborted: undefined,
     timeoutCb: null,
     upgradeOrConnect: false,
     parser: null,
     maxHeadersCount: null,
     _redirectable:
      Writable {
        _writableState: [Object],
        writable: true,
        domain: null,
        _events: [Object],
        _eventsCount: 2,
        _maxListeners: undefined,
        _options: [Object],
        _redirectCount: 0,
        _redirects: [],
        _requestBodyLength: 677,
        _requestBodyBuffers: [],
        _onNativeResponse: [Function],
        _currentRequest: [Circular],
        _currentUrl: 'https://api.monday.com/v2' },
     [Symbol(outHeadersKey)]:
      { accept: [Array],
        'content-type': [Array],
        authorization: [Array],
        'user-agent': [Array],
        'content-length': [Array],
        host: [Array] } },
  data: { data: { create_item: [Object] }, account_id: 5176844 } }

  • Author
  • Participating Frequently
  • February 26, 2020

@dipro Can you help me?


  • Author
  • Participating Frequently
  • March 3, 2020

@dipro
Hi, could you help me with my problem?


dipro
Forum|alt.badge.img
  • Leader
  • March 11, 2020

Hey @GameMaster2030 – sorry for the late response here.

Can you shoot us a ticket at support@monday.com? Please ask for me and reference this post in your email.

I’ll be able to troubleshoot better over email.


  • New Participant
  • April 29, 2020

I have a same issue…


  • New Participant
  • April 29, 2020

Sorry. It succeeded.
Reference: Node.js mutation example using Axios - #2 by danielco
There is a typo columnsValues: JSON.stringifycolumnValues: JSON.stringify


  • February 25, 2021

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