Magento 2.3.1 Newsletter subscription GraphQl supportHow to get order list of customer using graphql?What is GraphQl in Magento2 and Why use?“Error filtering template” - no static blocks in description by graphqlOrder emails and newsletter subscription emails are not sending in magento2.2.7?Newsletter subscription confirmation email not sentMagento 2.3.1 Error on checkout getAdditionalInformation()Magento 2 Newsletter Subscription via AjaxAfter Newsletter Subscription,Confirmation Message Should be display on top instead of bottom on Home PageMagento 2.3.1 authorizenet-acceptjs does not support partial refundsHow to remove GraphQL from Magento 2.3?

Can the additional attack from a Samurai's Rapid Strike have advantage?

Error with uppercase in titlesec's label field

Overful hbox (How to make the sentence in a table into 2 line?)

How do Canadians get a visa to go to Saudi Arabia?

Has the US government provided details on plans to deal with AIDS and childhood cancer?

Applying for mortgage when living together but only one will be on the mortgage

Is the EU really banning "toxic propellants" in 2020? How is that going to work?

What is the most 'environmentally friendly' way to learn to fly?

Is it unprofessional to mention your cover letter and resume are best viewed in Chrome?

Skipping same old introductions

How to derive trigonometric Cartesian equation from parametric

Why are prop blades not shaped like household fan blades?

What is the significance of $(logname)?

How to structure presentation to avoid getting questions that will be answered later in the presentation?

Should 2FA be enabled on service accounts?

Accurately recalling the key - can everyone do it?

Can birds evolve without trees?

IBM mainframe classic executable file formats

mv Command Deleted Files In Source Directory and Target Directory

Why have both: BJT and FET transistors on IC output?

The grades of the students in a class

Can I say "Gesundheit" if someone is coughing?

How to trick a fairly simplistic kill-counter?

Is it moral to remove/hide certain parts of a photo, as a photographer?



Magento 2.3.1 Newsletter subscription GraphQl support


How to get order list of customer using graphql?What is GraphQl in Magento2 and Why use?“Error filtering template” - no static blocks in description by graphqlOrder emails and newsletter subscription emails are not sending in magento2.2.7?Newsletter subscription confirmation email not sentMagento 2.3.1 Error on checkout getAdditionalInformation()Magento 2 Newsletter Subscription via AjaxAfter Newsletter Subscription,Confirmation Message Should be display on top instead of bottom on Home PageMagento 2.3.1 authorizenet-acceptjs does not support partial refundsHow to remove GraphQL from Magento 2.3?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















We are implementing PWA theme for our Magento 2.3.1 site. Magento 2.3.1 already have many modules GraphQl supported, but unfortunately magento_newsletter module is not supported yet. So I need to make my own module for it.



I have made the endpoint for GraphQl working, so the PWA template can call my custom module for adding the newsletter.



What i'm struggling now is to add the data into the database. I did some research, and I'm convinced that I need to use Resolver, so in my custom module, I have this,



app/code/myVendor/NewsletterGraphQl/Model/Resolver/signupNewsletter.php

<?php

namespace myVendorNewsletterGraphQlModelResolver;

use MagentoFrameworkAppActionContext;
use MagentoFrameworkGraphQlConfigElementField;
use MagentoFrameworkGraphQlQueryResolverContextInterface;
use MagentoFrameworkGraphQlQueryResolverValue;
use MagentoFrameworkGraphQlQueryResolverInterface;
use MagentoFrameworkGraphQlSchemaTypeResolveInfo;
use MagentoCustomerApiCustomerRepositoryInterface;
use MagentoNewsletterModelSubscriber;
use MagentoFrameworkGraphQlExceptionGraphQlInputException;
use MagentoFrameworkGraphQlExceptionGraphQlNoSuchEntityException;
use MagentoFrameworkGraphQlExceptionGraphQlAuthorizationException;

/**
* Class signupNewsletter
*/

class signupNewsletter implements ResolverInterface

public function __construct(
Subscriber $subscriberFactory
)
$this->subscriberFactory = $subscriberFactory;



public function resolve(
Field $field,
$context,
ResolveInfo $info,
array $value = null,
array $args = null
)

return [
'status' => "you are subscribed to newsletter"
];




and this is my schema.graphqls



type Mutation 
signupNewsletter(name: String!, email: String!, country: String!): CreateNewsletter @resolver(class:"\myVendor\NewsletterGraphQl\Model\Resolver\signupNewsletter")


type CreateNewsletter
status: String @doc(description: "Customer email verification status")



My Question is, what should I do in this resolver to add the new subscribers into the database?










share|improve this question
































    0















    We are implementing PWA theme for our Magento 2.3.1 site. Magento 2.3.1 already have many modules GraphQl supported, but unfortunately magento_newsletter module is not supported yet. So I need to make my own module for it.



    I have made the endpoint for GraphQl working, so the PWA template can call my custom module for adding the newsletter.



    What i'm struggling now is to add the data into the database. I did some research, and I'm convinced that I need to use Resolver, so in my custom module, I have this,



    app/code/myVendor/NewsletterGraphQl/Model/Resolver/signupNewsletter.php

    <?php

    namespace myVendorNewsletterGraphQlModelResolver;

    use MagentoFrameworkAppActionContext;
    use MagentoFrameworkGraphQlConfigElementField;
    use MagentoFrameworkGraphQlQueryResolverContextInterface;
    use MagentoFrameworkGraphQlQueryResolverValue;
    use MagentoFrameworkGraphQlQueryResolverInterface;
    use MagentoFrameworkGraphQlSchemaTypeResolveInfo;
    use MagentoCustomerApiCustomerRepositoryInterface;
    use MagentoNewsletterModelSubscriber;
    use MagentoFrameworkGraphQlExceptionGraphQlInputException;
    use MagentoFrameworkGraphQlExceptionGraphQlNoSuchEntityException;
    use MagentoFrameworkGraphQlExceptionGraphQlAuthorizationException;

    /**
    * Class signupNewsletter
    */

    class signupNewsletter implements ResolverInterface

    public function __construct(
    Subscriber $subscriberFactory
    )
    $this->subscriberFactory = $subscriberFactory;



    public function resolve(
    Field $field,
    $context,
    ResolveInfo $info,
    array $value = null,
    array $args = null
    )

    return [
    'status' => "you are subscribed to newsletter"
    ];




    and this is my schema.graphqls



    type Mutation 
    signupNewsletter(name: String!, email: String!, country: String!): CreateNewsletter @resolver(class:"\myVendor\NewsletterGraphQl\Model\Resolver\signupNewsletter")


    type CreateNewsletter
    status: String @doc(description: "Customer email verification status")



    My Question is, what should I do in this resolver to add the new subscribers into the database?










    share|improve this question




























      0












      0








      0








      We are implementing PWA theme for our Magento 2.3.1 site. Magento 2.3.1 already have many modules GraphQl supported, but unfortunately magento_newsletter module is not supported yet. So I need to make my own module for it.



      I have made the endpoint for GraphQl working, so the PWA template can call my custom module for adding the newsletter.



      What i'm struggling now is to add the data into the database. I did some research, and I'm convinced that I need to use Resolver, so in my custom module, I have this,



      app/code/myVendor/NewsletterGraphQl/Model/Resolver/signupNewsletter.php

      <?php

      namespace myVendorNewsletterGraphQlModelResolver;

      use MagentoFrameworkAppActionContext;
      use MagentoFrameworkGraphQlConfigElementField;
      use MagentoFrameworkGraphQlQueryResolverContextInterface;
      use MagentoFrameworkGraphQlQueryResolverValue;
      use MagentoFrameworkGraphQlQueryResolverInterface;
      use MagentoFrameworkGraphQlSchemaTypeResolveInfo;
      use MagentoCustomerApiCustomerRepositoryInterface;
      use MagentoNewsletterModelSubscriber;
      use MagentoFrameworkGraphQlExceptionGraphQlInputException;
      use MagentoFrameworkGraphQlExceptionGraphQlNoSuchEntityException;
      use MagentoFrameworkGraphQlExceptionGraphQlAuthorizationException;

      /**
      * Class signupNewsletter
      */

      class signupNewsletter implements ResolverInterface

      public function __construct(
      Subscriber $subscriberFactory
      )
      $this->subscriberFactory = $subscriberFactory;



      public function resolve(
      Field $field,
      $context,
      ResolveInfo $info,
      array $value = null,
      array $args = null
      )

      return [
      'status' => "you are subscribed to newsletter"
      ];




      and this is my schema.graphqls



      type Mutation 
      signupNewsletter(name: String!, email: String!, country: String!): CreateNewsletter @resolver(class:"\myVendor\NewsletterGraphQl\Model\Resolver\signupNewsletter")


      type CreateNewsletter
      status: String @doc(description: "Customer email verification status")



      My Question is, what should I do in this resolver to add the new subscribers into the database?










      share|improve this question
















      We are implementing PWA theme for our Magento 2.3.1 site. Magento 2.3.1 already have many modules GraphQl supported, but unfortunately magento_newsletter module is not supported yet. So I need to make my own module for it.



      I have made the endpoint for GraphQl working, so the PWA template can call my custom module for adding the newsletter.



      What i'm struggling now is to add the data into the database. I did some research, and I'm convinced that I need to use Resolver, so in my custom module, I have this,



      app/code/myVendor/NewsletterGraphQl/Model/Resolver/signupNewsletter.php

      <?php

      namespace myVendorNewsletterGraphQlModelResolver;

      use MagentoFrameworkAppActionContext;
      use MagentoFrameworkGraphQlConfigElementField;
      use MagentoFrameworkGraphQlQueryResolverContextInterface;
      use MagentoFrameworkGraphQlQueryResolverValue;
      use MagentoFrameworkGraphQlQueryResolverInterface;
      use MagentoFrameworkGraphQlSchemaTypeResolveInfo;
      use MagentoCustomerApiCustomerRepositoryInterface;
      use MagentoNewsletterModelSubscriber;
      use MagentoFrameworkGraphQlExceptionGraphQlInputException;
      use MagentoFrameworkGraphQlExceptionGraphQlNoSuchEntityException;
      use MagentoFrameworkGraphQlExceptionGraphQlAuthorizationException;

      /**
      * Class signupNewsletter
      */

      class signupNewsletter implements ResolverInterface

      public function __construct(
      Subscriber $subscriberFactory
      )
      $this->subscriberFactory = $subscriberFactory;



      public function resolve(
      Field $field,
      $context,
      ResolveInfo $info,
      array $value = null,
      array $args = null
      )

      return [
      'status' => "you are subscribed to newsletter"
      ];




      and this is my schema.graphqls



      type Mutation 
      signupNewsletter(name: String!, email: String!, country: String!): CreateNewsletter @resolver(class:"\myVendor\NewsletterGraphQl\Model\Resolver\signupNewsletter")


      type CreateNewsletter
      status: String @doc(description: "Customer email verification status")



      My Question is, what should I do in this resolver to add the new subscribers into the database?







      magento2.3.1 newsletter-subscriber graphql






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 23 at 8:58







      Magento Learner

















      asked Jul 23 at 8:51









      Magento LearnerMagento Learner

      78112 silver badges41 bronze badges




      78112 silver badges41 bronze badges























          0






          active

          oldest

          votes














          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "479"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f282960%2fmagento-2-3-1-newsletter-subscription-graphql-support%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f282960%2fmagento-2-3-1-newsletter-subscription-graphql-support%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

          Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

          Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form