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

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

          Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

          Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?