bizmsg-alimtalk-node-sdk

A module for sending Kakao notifications via Bizmsg API


License
MIT
Install
npm install bizmsg-alimtalk-node-sdk@2.1.0

Documentation

bizmsg-alimtalk-node-sdk

A module for sending Kakao notifications via Bizmsg API
비즈엠 API를 이용한 알림톡 전송 지원 서비스

Installing

Using npm:

$ npm install bizmsg-alimtalk-node-sdk

Using yarn:

$ yarn add bizmsg-alimtalk-node-sdk

Methods

intializeMessageTemplate(Array<MessageTemplate>)

Initializes an MessageTemplateDict object from an array of MessageTemplate objects.
Throws error if the given MessageTemplate goes against Bizmsg's policy of message templates.

intializeButtonTemplate(Array<ButtonTemplate>)

Initializes a ButtonTemplateDict object from an array of ButtonTemplate objects.
Throws error if the given ButtonTemplate goes against Bizmsg's policy of button templates.

intializeQuickReplyTemplate(Array<QuickReplyTemplate>)

Initializes a QuickReplyTemplateDict object from an array of QuickReplyTemplate objects.
Throws error if the given QuickReplyTemplate goes against Bizmsg's policy of quick reply templates.

intializeItemListTemplate(Array<ItemListTemplate>)

Initializes an ItemListTemplateDict object from an array of ItemListTemplate objects.
Throws error if the given ItemListTemplate goes against Bizmsg's policy of item list templates.

sendMessageAndGetResponse({sendType: sendType, phoneNumber: number, messageTemplate: MessageTemplate, keyValue: KeyValue})

sendType: *default*
Sends a Kakaotalk notification via BizmsgAPI and returns a CleanedJSON containing the message ID of the sent message.
Requires the following environmental variables: BIZMSGID,

  • biz msg profile key should be supplied via arguments.

TODO Update the environmental variables to that of https://www.bizmsg.kr/

TODO messageTemplate must be pre-registered and authorized at https://www.bizmsg.kr/
If the messageTemplate provided to the method does not exactly match the ones authorized on the site, the method will throw an error.

sendType: *mock-success*
Mocks a successive notification send request

sendType: *mock-fail*
Mocks a failed notification send request

sendType: *test*
Used for developmental testing purposes
Requires the following environmental variables: BIZMSGID, TESTPHONENUM

TEST Update the environmental variables to that of https://dev-admin.bizmsg.kr/

TEST messageTemplate must be pre-registered and authorized at https://dev-admin.bizmsg.kr/
If the messageTemplate provided to the method does not exactly match the ones authorized on the site, the method will throw an error.

TEST Authorize template at https://dev-admin.bizmsg.kr/

curl -X POST 'https://dev-alimtalk-api.bizmsg.kr:1443/v2/partner/test/template/approve' -H "userid:*dev-userID*" -d "senderKey=*dev-senderKey*&templateCode=*dev-templateCode*"

TEST Authorize phone request

curl -X POST 'https://dev-alimtalk-api.bizmsg.kr:1443/v2/partner/test/user/token?phoneNumber=*phonenumber*'

TEST Authorize phone with token

curl -X POST 'https://dev-alimtalk-api.bizmsg.kr:1443/v2/partner/test/user/certify?phoneNumber=*phonenumber*&token=*token*'

TEST Add the Kakaotalk channel sending the notification