How to Append a Contact to an Attendee List Using App Step Instead of API due to OAuth Error?

This topic was automatically generated from Slack. You can find the original thread here.

can anyone help me to append a contact to attendee list. Want to do it using app step and not using api. using api is causing oauth error

Hi , would you kind sharing a screenshot of your action, and also the expected outcome you want?

the variable in attendee is getting wrapped in another array

I am adding a new element in this array

You can use

{{ [...steps.get_event_1.$return_value.attendess, "email1@test.com", "email2@test.com" ]
}}

This is the update value returning from node step:

[
  {
    email: '[anand+gtest+1@mailmodo.com](mailto:anand+gtest+1@mailmodo.com)',
    responseStatus: 'needsAction'
  },
  {
    email: '[anand+gtest+2@mailmodo.com](mailto:anand+gtest+2@mailmodo.com)',
    responseStatus: 'needsAction'
  }
]

This is how I am using it in google calendar step

{{ [...steps.node.$return_value] }}

This wraps it inside another array. and can not use spread without []

I’m not sure I understand your message. Could you share the input you have and the expected outcome you want?

input to attendees field:

[
  {
    email: '[anand+gtest+1@mailmodo.com](mailto:anand+gtest+1@mailmodo.com)',
    responseStatus: 'needsAction'
  },
  {
    email: '[anand+gtest+2@mailmodo.com](mailto:anand+gtest+2@mailmodo.com)',
    responseStatus: 'needsAction'
  }
]

output: same as it, but whats happening is, it is wrapping it in another array

I still not understand what you mean, where is the Node.js step? Could you share screenshot?

the input is being returned from node js.

steps.node.$return_value

variable name

and I want to feed this input to attendee in another step

In your Node.js code, you’ll need to return the list of email to pass to the Google Calendar - Update Event Attendees.

So in your Node.js code, instead of returning the obj like this

return [
  {
    email: '[anand+gtest+1@mailmodo.com](mailto:anand+gtest+1@mailmodo.com)',
    responseStatus: 'needsAction'
  },
  {
    email: '[anand+gtest+2@mailmodo.com](mailto:anand+gtest+2@mailmodo.com)',
    responseStatus: 'needsAction'
  }
]

You’ll need to map it to array of email

return [
'[anand+gtest+1@mailmodo.com](mailto:anand+gtest+1@mailmodo.com)',
'[anand+gtest+2@mailmodo.com](mailto:anand+gtest+2@mailmodo.com)'
]

You can simply use a map function

return [
  {
    email: '[anand+gtest+1@mailmodo.com](mailto:anand+gtest+1@mailmodo.com)',
    responseStatus: 'needsAction'
  },
  {
    email: '[anand+gtest+2@mailmodo.com](mailto:anand+gtest+2@mailmodo.com)',
    responseStatus: 'needsAction'
  }
].map(obj => obj.email)

using

return [
'[anand+gtest+1@mailmodo.com](mailto:anand+gtest+1@mailmodo.com)',
'[anand+gtest+2@mailmodo.com](mailto:anand+gtest+2@mailmodo.com)'
]

is not updating the attendees. we need to specify emails in object with keys “email” like:

[
  {
    email: '[anand+gtest+1@mailmodo.com](mailto:anand+gtest+1@mailmodo.com)'
  },
  {
    email: '[anand+gtest+2@mailmodo.com](mailto:anand+gtest+2@mailmodo.com)'
  }
]

I think this needs sufficient coding knowledge to implement. If you’re still unsure that you can implement your usecase, you can:

  1. Read more about Pipedream Node.js document here and watch Pipedream University series to understand how Pipedream works
  2. Read more about Javascript, especially Node.js part. Also you can watch through Pipedream speedrun series to have more references
  3. Submit a ticket for Pipedream, stating the action on the app that you need
  4. If you have subscribed to Pipedream team plan, you will be added to a dedicated slack support channel
  5. If you’d like to hire a Pipedream expert for your usecase, feel free to use this link: Connect with a Pipedream Partner

see the return value was an array of emails. even after successful run, the value in attendee is not updated

I can update attendees for my test event just fine, would you mind checking if you have permission to update the Calendar you selected? Thanks

You added the email directly that’s why its working fine. can you try it using a variable that stores email inside an object in an array.
In this format:

steps.node.$return_value = [{email: "[anand@mailmodo.com](mailto:anand@mailmodo.com)"}, {email:"[anand2@mailmodo.com](mailto:anand2@mailmodo.com)"}]

The correct format is

steps.node.$return_value = ["[anand@mailmodo.com](mailto:anand@mailmodo.com)", "[anand2@mailmodo.com](mailto:anand2@mailmodo.com)"]