Skip to content

Commit

Permalink
[ext-290] update user create action
Browse files Browse the repository at this point in the history
  • Loading branch information
dannylwe committed Dec 10, 2024
1 parent 98030d1 commit 897d14d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
20 changes: 20 additions & 0 deletions integrations/zapier/actions/create-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,26 @@ export default async function runAction(nango: NangoAction, input: ZapierCreateU
});
}

const connection = await nango.getConnection();
if ('clientId' in connection.connection_config) {
input = { ...input, client_id: connection.connection_config['clientId'] };
} else {
throw new nango.ActionError({
message: `Zapier credentials (clientId) are incomplete`
});
}

if ('redirectURI' in connection.connection_config) {
input = {
...input,
redirect_uri: connection.connection_config['redirectURI']
};
} else {
throw new nango.ActionError({
message: `Zapier credentials (redirectURI) are incomplete`
});
}

const config: ProxyConfiguration = {
// https://docs.zapier.com/partner-solutions/api-reference/accounts/create-account
endpoint: `/v2/authorize`,
Expand Down
4 changes: 2 additions & 2 deletions integrations/zapier/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ export const validateZapierUserSchema = z.object({
firstName: z.string(),
lastName: z.string(),
email: z.string().email(),
client_id: z.string(),
redirect_uri: z.string().url(),
scope: z.string(),
client_id: z.string().optional(),
redirect_uri: z.string().url().optional(),
referer: z.string().optional(),
utm_campaign: z.string().optional(),
utm_content: z.string().optional(),
Expand Down

0 comments on commit 897d14d

Please sign in to comment.