Adding Users to a Group

MCorbin
MCorbin Overachievers Alumni
edited 05/17/23 in Add Ons and Integrations

I'm trying to build a workflow that will automatically add users to a Smartsheet Group if their email is our company's domain (to make it easier to share WorkApps and some universal workspaces).

I've got everything working but the darn HTTP call to add to the group

I am using Get Row to pull email addresses from my Users sheet (where I upload the User list from Admin Center).

In the HTTP Call, I'm trying to insert the data reference for the email into the body of the HTTP Call, but it's not working...

Any ideas what I'm doing wrong?


Tags:

Answers

  • MCorbin
    MCorbin Overachievers Alumni

    This is the error I'm getting:

    "Unable to parse request. The following error occurred: Unexpected character ('\\' (code 92)): was expecting double-quote to start field name\n at [Source: REST input; line: 1, column: 4]"

    I've tried removing the first \ but still getting the error.

    I'm guessing that it has to do with the data reference (email from the Get Row in my Users sheet), but I've tried switching that up and it's not working either.

    That column in the sheet is a text column - could that be the problem?

  • Brian_Richardson
    Brian_Richardson Overachievers Alumni

    Melanie here's the format I used in a Bridge workflow to push a body. No \ escape on the " marks. You may not need the [] array brackets or the extra object {}, that was a requirement for this particular workflow (Google Address Validation)

    {"address": {"addressLines": ["{{runtime.data.cells.5049890497318788.value||}}"]}}

    I would maybe try the following formatting for yours and see if it works? Also did you already run this through Postman and ensure that the API is just working in general?

    {"email":"{{states.startstate.smartsheet.get_row.row.cells.Email.value||}}"}

    I always put || in my references so that it doesn't error and stop the entire workflow if email happens to be blank on a row.

    One other idea - on a POST you have to put a header in for Content-Type with a value of application/json. Otherwise most APIs won't recognize your body at all.

    The "Unexpected character \\" error is, I think, coming because it sees the \" that you have and thinks it needs to escape the escape, so Bridge adds another \ to the mix, then the API doesn't understand what it's supposed to do with \\" in the body.

    BRIAN RICHARDSON | PMO TOOLS AND RESOURCES | HE|HIM

    SEATTLE WA, USA

    IRON MOUNTAIN

  • Brian_Richardson
    Brian_Richardson Overachievers Alumni
    edited 05/19/23

    You can also try leveraging the Form Parameters instead of the body, sometimes I find that is easier to use and works. So you'd have a Form Parameter called email with a Value of {{states.startstate.smartsheet.get_row.row.cells.Email.value||}}

    BRIAN RICHARDSON | PMO TOOLS AND RESOURCES | HE|HIM

    SEATTLE WA, USA

    IRON MOUNTAIN

  • MCorbin
    MCorbin Overachievers Alumni

    Woo hoo!!!!

    This worked! {"email":"{{states.startstate.smartsheet.get_row.row.cells.Email.value||}}"}

    I need to remember that darn pipe - it's gotten me before.....


    Thank you @Brian_Richardson !!!!!