node.js sendMail API error: "message": "The value of the parameter 'Message' is empty."

Nisha Mariam Johnson 1 Reputation point
2021-08-05T04:11:04.217+00:00

I am sending this node.js request through Pipedream:

async(event, steps, auths) => {
return await require("@pipedreamhq/platform").axios(this, {
  "url": `https://graph.microsoft.com/v1.0/me/sendMail`,
  "headers": {"Authorization": `Bearer ${auths.microsoft_outlook.oauth_access_token}`,
  "Content-Type": 'application/json'},
  "method": 'POST',
  "Message": {
  "toRecipients": [
    {
      "emailAddress": {
          address:`${steps.trigger.event.data.object.customer_details.email}`
      }
    }
  ],
  "Body": {
    "ContentType": "html",
    "Content": "Thank you for your purchase of this whatbuylists product list. The details of the list are available here: `${steps.get_product.$return_value.metadata.successURL}`"
  },
  "Subject": "Hey there, your whatbuylists product details are attached"
},
"SaveToSentItems": "true"
}
)
      }

And getting this error. How can I resolve it?:

{
  "error": {
    "code": "ErrorInvalidParameter",
    "message": "The value of the parameter 'Message' is empty."
  }
}
at null.createError (/tmp/ee/node_modules/@pipedreamhq/platform/node_modules/axios/lib/core/createError.js:16:15)
at null.settle (/tmp/ee/node_modules/@pipedreamhq/platform/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/tmp/ee/node_modules/@pipedreamhq/platform/node_modules/axios/lib/adapters/http.js:236:11)
at IncomingMessage.emit (events.js:387:35)
at null.endReadableNT (internal/streams/readable.js:1317:12)
at process.processTicksAndRejections (internal/process/task_queues.js:82:21)
How can I resolve this issue? I am new to coding and trying to automate a workflow in pipedream.
Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Deva-MSFT 2,271 Reputation points Microsoft Employee
    2021-08-23T16:59:54.387+00:00

    I tried the following node.js sample and it works for me. I would suggest you to try the same.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.