When creating user in Airtable, how to force sync between Sofr and Airtable to retrieve the MagicLink info

Hello,

I’m struggling with a simple case : retrieve the MagicLink in Airtable “softr-users” synced table, after creating a new user, to be able to trigger a welcome email with it.

Here is the process we go through:

  • automate in Airtable create a new record in Airtable “softr-users” synced table
  • MagicLink need to be created by Softr, and saved in Airtable with after a sync action
  • Once magiclink is created, email “Welcome” is sent

We want to minimize the time between creation and “Welcome” email sent, and for sure not to have to loggin and open the “User management” page of Softr to trigger the sync. How can we make that ? Trigger a sync with an API call using a bit a script in Airtable automation, just after adding the record in the table ?

Please advise. Thanks

PS : As this is a key component in user journery, detailing the other occasions behing “etc” in the list below, would be really useful to understand how the product works

  • When a user logs into an app.
  • When you publish new app changes.
  • When you visit the User tab.
    etc…

Code from the screenshot in my config

let inputConfig = input.config();
let userEmail = inputConfig.user_Email;

let apiUrl = `https://studio-api.softr.io/v1/api/users/magic-link/generate/${userEmail}`;

let requestOptions = {
  method: 'POST',
  headers: {
    'Softr-Api-Key': 'YOURAPIKEY',
    'Softr-Domain': 'YOURSOFTRAPP.softr.app'
  }
};

let response = await fetch(apiUrl, requestOptions);
console.log(await response.text());

I no longer use this though, instead I generate the entire account via api call in airtable (because internal staff are… they’re dumb, misspell their own names and emails and it’s not worth the headache) with a temporary password, and i have a user group “unverified” essentially so they are forced to set new password and verify info before accessing actual application

i suck at coding but once i figured out the script it works quite nice!

This is really nice from you @danyalamriben - thanks for sharing this valuable piece of code.
With it I’m half-way to my target. I know with this API call that the magic link is created on Softr user table side, but it is still not synced in Airtable “Softr-users” table, so I’m not able to send the welcome message with the link embedded from Airtable automation. Do you know by any chance, what it the API call to GET user details from Softr ? I didn’t find it here : API Setup and Endpoints – Softr Help Docs
Thanks !

1 Like

it should be synced. Go into softr app user settings. where you initially mapped your softr user information to your destination table in airtable. Ensure magic link field is connected. Should not be difficult!

also no clue hahaha i’m really not a coder… IDK if you can even get from their api? That’s for another community expert to answer LOL sorry cant be more helpful!

Thanks for the feedback. Can you please share the API call to create the user ?
The call to generate Magic Link does nothing from what I understand, since the user has only been created on Airtable side, and sync action is only triggered by Softr - so if you don’t login or open the user list page it doesn’t get known by softr. And I do have the link connected for magic link