How to

Subscribe to newsletter

Add email subscribers to your newsletter using Geins Merchant API

Prerequisites

  • Merchant API key
  • Valid email address to subscribe

Goal

  • Subscribe an email address to your newsletter with optional tags and targeting

Architecture at a glance

  • Use subscribeToNewsletter mutation → Provide email and optional parameters → Confirm subscription

Example

To subscribe an email to your newsletter, use the subscribeToNewsletter mutation in the Merchant API. At minimum, you need to provide an email address.

Try it out in the GraphQL Playground using the query, headers and variables below.

Request example

mutation subscribeToNewsletter(
    $email: String!
    $tags: [String]
    $channelId: String 
    $languageId: String
    $marketId: String
) {
  subscribeToNewsletter(
    email: $email 
    tags: $tags
    channelId: $channelId
    languageId: $languageId
    marketId: $marketId
  )
}
The channelId, languageId, and marketId arguments are optional and can be left out to use default values.

Response example

200 OK
response.json
{
  "data": {
    "subscribeToNewsletter": true
  }
}

Options

Tags

You can supply an optional list of tags when subscribing an email address. This will get sent to your newsletter provider and can be used for segmentation.

Query Variables example with tags

query-variables.json
{
  "email": "{USER_EMAIL}",
  "tags": ["promotion", "new-products"],
  "channelId": "{CHANNEL_ID}",
  "languageId": "{LANGUAGE_ID}",
  "marketId": "{MARKET_ID}"
}

Channel, Language, and Market

The mutation also supports optional parameters for multi-market support:

Read more about channelId, languageId, and marketId in the "how to"-article about using multi-market support..
Related