fastify-xwhatconverts
profiles.create
Create a new WhatConverts profile under an account.
profiles.create
Create a new profile within an account. Profiles are what leads are tracked against and what holds the tracking numbers and settings.
Signature
fastify.xwhatconverts.profiles.create(params: {
accountId: string;
profileName: string;
profileUrl?: string;
}): Promise<object>
Params
| Name | Type | Required | Description |
|---|---|---|---|
accountId | string | Yes | ID of the account to create the profile under. |
profileName | string | Yes | Display name for the profile. |
profileUrl | string | No | Website URL for the profile. |
Returns
The created WhatConverts profile object.
Throws
[xWhatConverts] profiles.create: params object is required— called without a params object.[xWhatConverts] profiles.create: accountId is required— missingaccountId.[xWhatConverts] profiles.create: profileName is required— missingprofileName.[xWhatConverts] Network error: <message>— network-level failure.[xWhatConverts] API error: <status>— non-2xx response from WhatConverts.
Examples
Basic — create a profile
const profile = await fastify.xwhatconverts.profiles.create({
accountId: "555",
profileName: "Main Website",
profileUrl: "https://example.com",
});
console.log(profile.profile_id);
Realistic — create a profile during client onboarding
fastify.post("/onboard", async (request, reply) => {
const { clientName, siteUrl } = request.body;
const account = await fastify.xwhatconverts.accounts.create({
accountName: clientName,
});
const profile = await fastify.xwhatconverts.profiles.create({
accountId: account.account_id,
profileName: `${clientName} — Primary`,
profileUrl: siteUrl,
});
return reply.status(201).send({
accountId: account.account_id,
profileId: profile.profile_id,
});
});
See Also
- profiles.get — fetch the created profile
- accounts.create — create the parent account
- leads.create — create leads under this profile
AI Context
package: "@xenterprises/fastify-xwhatconverts"
method: fastify.xwhatconverts.profiles.create(params)
use-when: Create a new WhatConverts profile (tracking container) under an account
params: accountId (string, required), profileName (string, required)
returns: created WhatConverts profile object
