How Can I Write a Python or Node.js Code to Auto Transfer Google Sheet Entries to <http://Sender.net|Sender.net> API Using Pipedream?

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

@U02SX7ETBFB,
I am trying to auto transfer googlesheet entries to SENDER.NET using pipedream. I have linked the sheet but My issue is I have to write a python or node.js code to import from the sheet to Sender.net API and I do not know how to write this.

Please can someone kindly help? I tried using ChatGPT but not making headsway

Sure, I can help you with that. To transfer Google Sheets entries to SENDER.NET using Pipedream, you’ll need to create a workflow that triggers on new Google Sheets entries and then makes a POST request to the SENDER.NET API. Here’s a basic example of how you might set this up using Node.js: import { axios } from "@pipedream/platform"; export default defineComponent({ props: { google_sheets: { type: "app", app: "google_sheets", }, sender: { type: "app", app: "sender", }, sheetId: { type: "string", label: "Sheet ID", description: "The ID of the Google Sheet", }, senderEndpoint: { type: "string", label: "[SENDER.NET](http://SENDER.NET) Endpoint", description: "The endpoint to post data to on [SENDER.NET](http://SENDER.NET)", }, }, async run({ steps, $ }) { // Get the latest entry from the Google Sheet const response = await axios($, { method: "GET", url: `https://sheets.googleapis.com/v4/spreadsheets/${this.sheetId}/values/Sheet1`, headers: { Authorization: `Bearer ${this.google_sheets.$auth.oauth_access_token}`, }, }); // Extract the data from the latest entry const latestEntry = response.data.values.pop(); // Post the data to the [SENDER.NET](http://SENDER.NET) API await axios($, { method: "POST", url: this.senderEndpoint, headers: { Authorization: `Bearer ${this.sender.$auth.oauth_access_token}`, }, data: latestEntry, }); }, }); This code assumes that you have a Google Sheets app and a SENDER.NET app set up in Pipedream. You’ll need to replace 'Sheet1' with the name of your sheet, and '[SENDER.NET](http://SENDER.NET) Endpoint' with the actual endpoint you’re posting data to on SENDER.NET. Please note that this is a basic example and you might need to adjust the code to fit your specific needs, such as formatting the data from the Google Sheet entry before sending it to SENDER.NET.

I deleted the other threads you started because Pi reads threads context for future answers. Making new threads “refreshes” Pi’s memory.

can you show me how I can make an authenticated request to the Sender.net API to create a new Subscriber in a Node.js code step? It should pass the email, firstname and lastname as props?

can you show me how I can make an authenticated request to the Sender.net API to create a new Subscriber in a Node.js code step? It should pass the email, firstname and lastname as props?