KakaoTalk sender
To create a KakaoTalk sender, you need a valid plusFriendId
and some information about the sender you intend to create. In order to succesfully configure a KakaoTalk sender for use with the Conversation API, you must:
Note that, for this guide, we provide Node.js code samples. However, the principles apply to any language you use to make requests to the API.
Creating a sender
The following code sample creates a KakaoTalk sender using the Provisioning API:
import fetch from 'node-fetch';
async function createSender() {
const resp = await fetch(
`https://provisioning.api.sinch.com/v1/projects/${PROJECT_ID}/kakaotalk/senders`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization:
'Basic ' +
Buffer.from(ACCESS_KEY + ':' + ACCESS_SECRET).toString('base64'),
},
body: JSON.stringify({
plusFriendId: 'plusFriendId',
details: {
adminPhoneNo: '+48777777777',
name: 'Test Name',
topLevelCategoryCode: '019',
midLevelCategoryCode: '0006',
subLevelCategoryCode: '0001',
},
}),
}
);
const data = await resp.json();
return data;
}
After creating the sender, you'll need to verify it.
Note:
Once created, the sender's status will be set to IN_PROGRESS
. Note that, after a review, the sender could be rejected. If the sender is rejected, the status of the sender will be set to REJECTED
. The notifications endpoint can be used to see if there is any comment explaining the reason for rejection. If rejected, the sender can be edited and submitted again.
Verifying the sender
Once the sender reaches the PENDING_VERIFICATION
status, the phone number needs to be verified. Start the process by triggering the Register sender endpoint:
import fetch from 'node-fetch';
async function registerSender() {
const resp = await fetch(
`https://provisioning.api.sinch.com/v1/projects/${PROJECT_ID}/kakaotalk/senders/${PLUS_FRIEND_ID}/register`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization:
'Basic ' +
Buffer.from(ACCESS_KEY + ':' + ACCESS_SECRET).toString('base64'),
},
}
);
const data = await resp.json();
return data;
}
This will send a one time passcode (OTP) to the phone number used to populate the adminPhoneNo
field referenced in the previous section.
Once the OTP code has been received, verify the sender, using the Verify sender endpoint, with the following code:
import fetch from 'node-fetch';
async function verifySender() {
const resp = await fetch(
`https://provisioning.api.sinch.com/v1/projects/${PROJECT_ID}/kakaotalk/senders/${PLUS_FRIEND_ID}/verify`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization:
'Basic ' +
Buffer.from(ACCESS_KEY + ':' + ACCESS_SECRET).toString('base64'),
},
body: JSON.stringify({
code: '123456',
}),
}
);
const data = await resp.json();
return data;
}
The sender will continue through the state transitions and eventually become ACTIVE
. A notification will be triggered once the status changes to ACTIVE
, at which point you can create templates for the sender.