Skip to content

Create Newsletter

About

The createNewsletter mutation subscribes the authenticated customer to the store newsletter on the current channel. Use this mutation to:

  • Add newsletter opt-in to the storefront footer or account page
  • Re-subscribe a customer who previously unsubscribed
  • Capture marketing consent during registration or checkout
  • Track submissions using clientMutationId

The subscription is scoped to the current channel.

Authentication

This mutation requires customer authentication:

  • Authenticated customers: Provide a valid customer authentication token in the Authorization header. Obtain this token via the Customer Login API.
Authorization: Bearer <accessToken>

Arguments

ArgumentTypeRequiredDescription
inputcreateNewsletterInput!✅ YesInput object containing the subscription fields.

Input Fields (createNewsletterInput)

FieldTypeRequiredDescription
customerEmailString!✅ YesEmail address to subscribe. Must be valid and unique in the subscribers list.
clientMutationIdString❌ NoOptional client-side identifier for tracking the mutation request.

Possible Returns

FieldTypeDescription
newsletter.successBoolean!true if the subscription was created successfully.
newsletter.messageString!Human-readable confirmation or error message.
clientMutationIdStringEchoed back from the input if provided.

Use Cases

Trigger this mutation when a logged-in customer submits the newsletter form, then display message as feedback.

2. Account Preferences

Let customers manage their marketing consent from the account settings page.

Best Practices

  1. Validate email client-side first to reduce unnecessary API calls.
  2. Always read success before showing a success state.
  3. Handle the already-subscribed case gracefully — surface the server message.

Released under the MIT License.