> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: createContact(contactInfo: ContactInfo, options: Options) # Method package: wixCrmBackend # Method menu location: wixCrmBackend --> Contacts --> createContact # Method Link: https://dev.wix.com/docs/velo/apis/wix-crm-backend/contacts/create-contact.md # Method Description: Creates a new contact. The `createContact()` function returns a Promise that resolves to the new contact when it is created. > **Note:** > This function replaces the deprecated > `wixCrmBackend.createContact()`. > The deprecated function will continue to work, but it will not receive updates. > To keep any existing code compatible with future changes, see the > [migration instructions](https://dev.wix.com/docs/velo/api-reference/wix-crm-backend/create-contact.md). The `contactInfo` parameter object must include a name, phone number, or email address. If all 3 of these parameters are missing, the contact won't be created. By default, if the call contains an email already in use by another contact, the new contact won't be created. To override this behavior, set `allowDuplicates` in the `options` object to `true`. > **Note:** > Only visitors with > **Manage Contacts** [permissions](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Froles-and-permissions) > can create contacts. > You can override the permissions by setting the `suppressAuth` option to `true`. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Create a new contact with a name ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { contacts } from 'wix-crm-backend'; export const myCreateContactFunction = webMethod(Permissions.Anyone, () => { const contactInfo = { name: { first: "Ari", last: "Thereyet" } }; const options = { allowDuplicates: false, suppressAuth: false }; return contacts.createContact(contactInfo, options) .then((contact) => { return contact; }) .catch((error) => { console.error(error); }); }); /* Promise resolves to: * { * "_id": "bbc44e99-4439-4a51-ac8c-77d6a9bb6243", * "_createdDate": "2021-07-26T06:32:46.466Z", * "_updatedDate": "2021-07-26T06:32:46.467Z", * "revision": 0, * "info": { * "name": { * "first": "Ari", * "last": "Thereyet" * }, * "extendedFields": { * "contacts.displayByFirstName": "Ari Thereyet", * "contacts.displayByLastName": "Thereyet Ari" * } * }, * "lastActivity": { * "activityDate": "2021-07-26T06:32:46.466Z", * "activityType": "CONTACT_CREATED" * }, * "source": { * "appId": "v4.createContact", * "sourceType": "OTHER" * } * } */ ``` ## Create a new contact, full object ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { contacts } from 'wix-crm-backend'; export const myCreateContactFunction = webMethod(Permissions.Anyone, () => { const contactInfo = { name: { first: "Gene", last: "Lopez" }, company: "Borer and Sons, Attorneys at Law", jobTitle: "Senior Staff Attorney", locale: "en-US", birthdate: "1981-11-02", profilePicture: "https://randomuser.me/api/portraits/men/0.jpg", emails: [ { tag: "WORK", email: "gene.lopez@example.com" }, { tag: "HOME", email: "gene.lopez.at.home@example.com", primary: true } ], phones: [ { tag: "HOME", countryCode: "US", phone: "(704)-454-1233" }, { tag: "MOBILE", countryCode: "US", phone: "(722)-138-3099", primary: true } ], addresses: [ { tag: "HOME", address: { streetAddress: { number: "9834", name: "Bollinger Rd" }, formatted: "9834 Bollinger Rd\nEl Cajon, WY 97766\nUS", location: { latitude: "84.1048", longitude: "-116.8836" }, city: "El Cajon", subdivision: "WY", country: "US", postalCode: "97766" } } ], labelKeys: [ "custom.white-glove-treatment", "contacts.contacted-me", "custom.new-lead" ], extendedFields: { "custom.event-we-met-at": "LegalBigData" } }; const options = { allowDuplicates: false, suppressAuth: false }; return contacts.createContact(contactInfo, options) .then((contact) => { return contact; }) .catch((error) => { console.error(error); }); }); /* Promise resolves to: * { * "_id": "703d5a66-850d-4ecb-b967-445726a26c15", * "_createdDate": "2021-07-26T07:06:17.685Z", * "_updatedDate": "2021-07-26T07:06:17.686Z", * "revision": 0, * "info": { * "name": { * "first": "Gene", * "last": "Lopez" * }, * "profilePicture": "https://randomuser.me/api/portraits/men/0.jpg", * "birthdate": "1981-11-02", * "company": "Borer and Sons, Attorneys at Law", * "jobTitle": "Senior Staff Attorney", * "locale": "en-us", * "emails": [ * { * "_id": "ead5f037-515b-4e67-bc77-ac1d70f0cdac", * "tag": "HOME", * "email": "gene.lopez.at.home@example.com", * "primary": true * }, * { * "_id": "87a665a4-cde1-4b3c-b164-90e0a7472788", * "tag": "WORK", * "email": "gene.lopez@example.com", * "primary": false * } * ], * "phones": [ * { * "_id": "fada6859-e560-4590-a8bf-226a30537701", * "tag": "MOBILE", * "countryCode": "US", * "phone": "(722)-138-3099", * "primary": true * }, * { * "_id": "51efdd52-71f3-4562-906d-0c7212599f36", * "tag": "HOME", * "countryCode": "US", * "phone": "(704)-454-1233", * "e164Phone": "+17044541233", * "primary": false * } * ], * "addresses": [ * { * "address": { * "formatted": "9834 Bollinger Rd\nEl Cajon, WY 97766\nUS", * "location": { * "latitude": 84.1048, * "longitude": -116.8836 * }, * "city": "El Cajon", * "subdivision": "US-WY", * "country": "US", * "postalCode": "97766", * "streetAddress": { * "name": "Bollinger Rd", * "number": "9834", * "apt": "" * } * }, * "_id": "263e25c5-7f7f-4cab-9a4e-768ca74fd891", * "tag": "HOME" * } * ], * "labelKeys": [ * "custom.white-glove-treatment", * "contacts.contacted-me", * "custom.new-lead" * ], * "extendedFields": { * "custom.event-we-met-at": "LegalBigData" * } * }, * "primaryInfo": { * "email": "gene.lopez.at.home@example.com", * "phone": "(722)-138-3099" * }, * "lastActivity": { * "activityDate": "2021-07-26T07:06:17.685Z", * "activityType": "CONTACT_CREATED" * }, * "source": { * "appId": "151e476a-715e-ec33-db9a-a7ff4d51f70a", * "sourceType": "WIX_APP" * } * } */ ``` ---