How to add sms providers for two factor authenication

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • item
    commented on 's reply
    Many Thanks Yuri,
    you are ours professor too...

    Best Regards

  • yuri
    replied
    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.

    Leave a comment:


  • item
    replied
    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.




    Leave a comment:


  • sapyantuk
    commented on 's reply
    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

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

    Leave a comment:


  • sapyantuk
    replied
    How to fix this ?

    Leave a comment:


  • sapyantuk
    commented on 's reply
    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

  • esforim
    replied
    (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.

    Leave a comment:


  • 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
Working...