user-1
(User 1)
September 9, 2025, 6:41pm
1
This topic was automatically generated from Slack. You can find the original thread here .
hey we’re getting a 401 authorization issue with Instantly (slug: “instantly”) for using the proxy. Here is the error we are getting. Could it be a misconfiguration that’s easily fixable with pipedream? It seems they added a new v1 version with a bearer key auth https://developer.instantly.ai/
user-1
(User 1)
September 9, 2025, 6:41pm
2
Can you share the payload you’re sending?
user-1
(User 1)
September 9, 2025, 6:41pm
3
yes this was the code
import * as pd from "@pipedream/sdk";
async function execute(input) {
try {
const client = pd.createBackendClient({
environment: process.env.PIPEDREAM_ENVIRONMENT,
credentials: {
clientId: process.env.PIPEDREAM_CLIENT_ID,
clientSecret: process.env.PIPEDREAM_CLIENT_SECRET,
},
projectId: process.env.PIPEDREAM_PROJECT_ID
});
const proxyRequestOptions = {
searchParams: {
account_id: input.account_id,
external_user_id: input.external_user_id,
}
};
// Extract lead data from the Data Cleaning node
const customCodeOutput = input.ctx.custom_code;
const leadData = customCodeOutput?.output?.lead;
if (!leadData) {
throw new Error("No lead data found in input.ctx.custom_code.output.lead");
}
// Validate required email field
if (!leadData.email) {
throw new Error("Lead email is required but not found in the data");
}
// Prepare the lead object for Instantly API
const leadPayload = {
email: leadData.email,
first_name: leadData.first_name || "",
last_name: leadData.last_name || "",
company_name: leadData.company_name || "",
phone: leadData.phone || "",
website: leadData.website || "",
personalization: leadData.personalization || "",
custom_variables: leadData.custom_variables || {},
skip_if_in_workspace: leadData.skip_if_in_workspace || false,
skip_if_in_campaign: leadData.skip_if_in_campaign || false,
skip_if_in_list: leadData.skip_if_in_list || false,
verify_leads_on_import: leadData.verify_leads_on_import || false,
lt_interest_status: leadData.lt_interest_status || 1
};
// Make the API request to create a lead in Instantly
const appRequestConfig = {
url: "https://api.instantly.ai/api/v2/leads",
options: {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(leadPayload)
}
};
const response = await client.makeProxyRequest(proxyRequestOptions, appRequestConfig);
// Return the response from Instantly API
return {
output: {
success: true,
lead_created: response,
email: leadData.email,
message: "Lead successfully created in Instantly"
}
};
} catch (error) {
console.error("Error creating lead in Instantly:", error);
throw new Error(`Failed to create lead in Instantly: ${error.message}`);
}
}
user-1
(User 1)
September 9, 2025, 6:41pm
4
it seems to be that the auth is not sending the bearer key for the v2 of api. the docs mention that they used something other than the bearer key before the v2 migration
user-1
(User 1)
September 9, 2025, 6:41pm
6
Oh, interesting. Yea it’s possible. Can you try again?
user-1
(User 1)
September 9, 2025, 6:41pm
10
For sure! Thanks for the quick resolution