# Writing to Contacts to change subscriptionStatus

**URL:** <https://forum.wixstudio.com/t/writing-to-contacts-to-change-subscriptionstatus/55009>\
**Category:** Ask the community\
**Tags:** technical-talk, partners, code, question\
**Created:** [January 4, 2024, 5:13pm UTC](https://forum.wixstudio.com/t/writing-to-contacts-to-change-subscriptionstatus/55009 "2024-01-04T17:13:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SimonP](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/simonp/32/80542_2.png) [@SimonP](https://forum.wixstudio.com/u/SimonP)\
**Post date:** [January 4, 2024, 5:13pm UTC](https://forum.wixstudio.com/t/writing-to-contacts-to-change-subscriptionstatus/55009/1 "2024-01-04T17:13:02Z")

</div>

Happy New Year everyone!

I have a large number of users in a database on non-Wix site and have authorization to email them. I am importing the dB to Wix and want to be able to set subscriptionStatus in the Contacts collection, so my client can use the Wix tools for email marketing.

I am using Wix Studio to test how this works at the moment and am adding a Contact with this object:

This is my back end code - a self contained block that I trigger from the front end by calling the function. I pulled all this out of the API, except for the bit I’m struggling with.

```javascript

  console.log("running")
  const item = {
    name: {
      first: "Gene",
      last: "Lopez"
    },
    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
      }
    ],
    extendedFields: {
      ['emailSubscriptions.subscriptionStatus']: "subscribed"
    },
    labelKeys: [
      "custom.member"
    ]
  };

```

When I call this object to submit it using contacts.createContact(item, options), everything else goes into Contacts fine but I cannot figure out how to set the subscription setting…nothing I write to this field seems to stick - it shows NEVER SUBSCRIBED still. It doesn’t throw an error or anything, it just doesn’t get written to the contact.

Can anyone help point me in the right direction? I can’t see this in the API but it also doesn’t say it can’t be done. Surely I don’t have to go through every Contact in the collection setting these manually?..it’ll take forever! The alternative is to not set them and have the client use Mailchimp I guess…but that seems a little bit odd.

Simon.

---

<div class="post-metadata">

**Author:** ![CODE-NINJA](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/code-ninja/32/110588_2.png) [@CODE-NINJA](https://forum.wixstudio.com/u/CODE-NINJA)\
**Post date:** [January 4, 2024, 6:14pm UTC](https://forum.wixstudio.com/t/writing-to-contacts-to-change-subscriptionstatus/55009/2 "2024-01-04T18:14:45Z")

</div>

> [@SimonP](#):
>
> subscription

I just have something in my memories → that extended fields can only be used, when they were already generated inside contacts.

Would that solve your question? But i am not sure.

Let’s go through the issue…  
-To be able to work with CONTACTS → you will need wix-crm-backend.  
-The following information is important…

 ![2024-01-04 19_05_02-About Extended Fields - Velo API Reference - Wix.com](https://us1.discourse-cdn.com/wix/original/3X/0/9/09dbd2db32cd128ee08ab2346a91c5b89781b2a7.png)

Maybe this post can help you somehow…

> [@Querying the custom member fields](https://forum.wixstudio.com/t/querying-the-custom-member-fields/5688):
>
> Hi all, I have custom fields for members as outlined in the post below: [https://support.wix.com/en/article/customizing-your-member-profile-fields-7805119](https://support.wix.com/en/article/customizing-your-member-profile-fields-7805119) I can see the data on the forms, I can edit it works like a charm. However, when I want to query this data, I cannot find it in both Members/PrivateMembersData and Members/PublicData I tried to look for it in all the collections but no chance. How can I query the custom member field data using wix-query? Best,

---

<div class="post-metadata">

**Author:** ![SimonP](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/simonp/32/80542_2.png) [@SimonP](https://forum.wixstudio.com/u/SimonP)\
**Post date:** [January 5, 2024, 11:00am UTC](https://forum.wixstudio.com/t/writing-to-contacts-to-change-subscriptionstatus/55009/3 "2024-01-05T11:00:48Z")

</div>

Hi there Ninja.

I got to bottom of this last night. The subscription info is SYSTEM only and is not editable via Velo. All the custom fields, which are stored in extendedFields, are readable & writable, as long as they’ve been set-up first in the dashboard, which they were. I looked in wix-crm.v2 also and it hasn’t been changed there either.

This is, of course, patently ridiculous but we are where we are. I’m gong to push my client away from using Wix’s email marketing, which is a shame, as they were going to move away from MailChimp.

It would really be useful if the SYSTEM fields were at least highlighted in the Velo API under wix-crm somewhere…to avoid a repeat of my search for others. The only way I was able to determine the status was to use contacts.getExtendedField to look at the field. Not sure how easy it is to get this kind of things added though.

I’ve filed a feature request for edit rights for this field in both Velo and Email Marketing but I’m obviously not going to hold my breath on that…

Simon.

---

<div class="post-metadata">

**Author:** ![CODE-NINJA](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/code-ninja/32/110588_2.png) [@CODE-NINJA](https://forum.wixstudio.com/u/CODE-NINJA)\
**Post date:** [January 5, 2024, 12:54pm UTC](https://forum.wixstudio.com/t/writing-to-contacts-to-change-subscriptionstatus/55009/4 "2024-01-05T12:54:42Z")

</div>

> [@SimonP](#):
>
> as long as they’ve been set-up first

exactly!

This was what was in my memories…

> I just have something in my memories → that extended fields can only be used, when they were already generated inside contacts.

If i am honest, i did not take a closer look on your issue, maybe there is a way though, but this for i would have to investigate the whole setup. Workarounds are in most cases possible.

But this looks anyways promissing…

 ![2024-01-05 13_53_16-Sort, Filter, and Search - Velo API Reference - Wix.com](https://us1.discourse-cdn.com/wix/original/3X/4/9/49e5e2bf4e162c7f544b92701ee6f7c3aa0bf510.png)
