PHP code example of comento / laravel-sens-alimtalk

1. Go to this page and download the library: Download comento/laravel-sens-alimtalk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

comento / laravel-sens-alimtalk example snippets


/*
|--------------------------------------------------------------------------
| NAVER CLOUD PLATFORM API
|--------------------------------------------------------------------------
|
| Go to My Page > Manage Accoutn > Manage Auth Key
| You can use a previously created authentication key or create a new api authentication key.
|
*/
'access_key' => env('NCLOUD_ACCESS_KEY', ''),
'secret_key' => env('NCLOUD_SECRET_KEY', ''),

/*
 * Service ID issued when you add a project
 */
'service_id' => '',

/*
 * KakaoTalk Channel ID ((Old) Plus Friend ID)
 */
'plus_friend_id' => '',

/*
 * SMS Failover use status
 */
'use_sms_failover' => true,

// ...
use Comento\SensAlimtalk\SensAlimtalkChannel;
use Comento\SensAlimtalk\SensAlimtalkMessage;

class MentoringAdopt extends Notification
{
    use Queueable;

    private $mobiles;
    private $weblink_url;

    public function __construct($mobiles, $weblink_url)
    {
        $this->mobiles = $mobiles;
        $this->weblink_url = $weblink_url;
    }

    public function via($notifiable)
    {
        return [SensAlimtalkChannel::class];
    }

    public function toSensAlimtalk($notifiable)
    {
        return (new SensAlimtalkMessage())
            ->templateCode('adopt')
            ->to($this->mobiles)
            ->content('축하합니다!
현직자님의 답변이 채택되었습니다!
어떤 답변인지 확인하러 가볼까요?')
            ->button(['type' => 'WL', 'name' => '지금 보러가기', 'linkMobile' => $this->weblink_url, 'linkPc' => $this->weblink_url])
            ->utmSource('utm_source=crm-kakao&utm_medium=alimtalk&utm_campaign=mentoring-adopt&utm_term=지금 보러가기&utm_content=');
    }
}
bash
php artisan vendor:publish --provider="Comento\SensAlimtalk\SensAlimtalkServiceProvider"