How to add sms providers for two factor authenication

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sapyantuk
    Senior Member
    • Oct 2020
    • 286

    #1

    How to add sms providers for two factor authenication

    Hello Team,

    I want to add my sms providers in espo crm for two factor authenication how to add

    my sms providers supports http request
  • esforim
    Active Community Member
    • Jan 2020
    • 2227

    #2
    (1) Who is your SMS provider?
    (2) You can buy the extension (official and unofficial) that may support your provide.
    (3) I think the Advanced Pack can do CRUD/HTTPS request so it should be able to emulated the requirement your SMS have.

    Comment


    • sapyantuk
      sapyantuk commented
      Editing a comment
      I have my own local sms provider . i have to send http request to api with some unique id for authroization. currently i am using that sms service through advance pack now i want to use the same sms provider for two factor authenication

      please help me to setup my sms provider for using two factor authenication
  • sapyantuk
    Senior Member
    • Oct 2020
    • 286

    #3
    How to fix this ?

    Comment

    • yuri
      EspoCRM product developer
      • Mar 2014
      • 9800

      #4
      In release notes it's stated that there's no SMS providers shipped at this moment. Developers can add implementations for specific providers.

      Comment


      • sapyantuk
        sapyantuk commented
        Editing a comment
        Hello Yuri , I have my own sms provider i want to add that sms provider . my provider support http request but i dont know how to add my provider
    • item
      Active Community Member
      • Mar 2017
      • 1567

      #5
      Hello,

      are you developper ?
      i try to do same... but i can't test it actually :

      create file :
      custom/Ressources/metadata/app/smsProviders.json
      PHP Code:
      {
      "Spryng": "\\Espo\\Custom\\Core\\Provider\\SpryngSms"
      } 
      
      create file :
      custom/Core/Provider/SpryngSms.php
      PHP Code:
      <?php
      
      namespace Espo\Custom\Core\Provider;
      
      use Spryng\SpryngRestApi\{
      Spryng,
      Objects\Message,
      };
      use Espo\Core\ORM\EntityManager;
      use Espo\Core\Sms\Sms;
      
      class SpryngSms implements \Espo\Core\Sms\Sender
      {
      protected $entityManager;
      
      public function __construct( EntityManager $entityManager )
      {
      $this->entityManager = $entityManager;
      }
      
      public function send(Sms $sms) : void
      {
      $integration = $this->entityManager->getEntity('Integration', 'SpryngSms');
      $spryng = new Spryng( $integration->get('apiKey') );
      $messageSpryng = new Message();
      $messageSpryng->setOriginator($integration->get('originator') );
      $messageSpryng->setRoute('business');
      $messageSpryng->setEncoding('auto');
      $messageSpryng->setRecipients( $sms->getToNumberList() );
      $messageSpryng->setBody($sms->getBody());
      $response = $spryng->message->send($messageSpryng);
      }
      }
      Clear Cache

      now you can select Spryng

      Of course, you need to adapt to your Provider..

      I don't know if that's work..
      Maybe Yuri can say if i am on the right way

      So if somes developper do this kind of extension, the community will be happy.




      If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

      Comment

      • yuri
        EspoCRM product developer
        • Mar 2014
        • 9800

        #6
        To find out how to declare implementations in metadata check factory classes.

        https://github.com/espocrm/espocrm/b...actory.php#L66

        Your metadata is not right.

        PHP Code:
        {
            "Spryng": {
                "senderClassName": "Espo\\Custom\\Core\\Provider\\SpryngSms"
            }
        } 
        
        Last edited by yuri; 10-04-2021, 04:44 PM.

        Comment


        • item
          item commented
          Editing a comment
          Many Thanks Yuri,
          you are ours professor too...

          Best Regards
      Working...