Smart Sending
Like payment complete, delivery notification, etc. Functional messages required to use the serviceis used when sending directly from the partner company's server. You can effectively achieve goals such as improving retention and increasing service usage.
Console Smart Delivery Setup GuidePlease refer to it.
Preliminary preparations
Console setup is required
Before calling the API, you need to complete the steps below first.
Create a functional campaign in the Console and issue a template code (
templateSetCode).If the message requires a notification agreement, create the notification agreement first before creating the campaign, and link it to the functional campaign.
You must receive copy review approval. Before approval, even test messages cannot be sent.
For setup instructions, please refer to the Smart Delivery introduction document.
Identify the user to send to
The Smart Delivery API identifies recipients using one of the two methods below. Do not pass both values at the same time; choose only one.
userKey
Toss Loginis used to receive it.
anonKey
Issue a user identification keyis used to receive it.
Please choose according to your purpose.
If you have already integrated Toss Login, or want to manage it together with member information such as name and email,
userKeyuse it.If you want to identify only the user lightly without login integration,
anonKeyuse it.
The delivery location differs by API.
Test message, message: in the request header,
x-toss-user-keyorx-anon-keypass it.Bulk message: in the request body
contextListitemuserKeyoranonKeypass it.
x-anon-keyIf you want to check in advance whether the (hash) is a valid value, Use the key verification API please.
Basic information
Base URL
https://apps-in-toss-api.toss.im
Server authentication
mTLS (client certificate)
Content-Type
application/json
1. Send a test message
Create a functional campaign in the Console and receive copy review approval, then use this to check whether the bundle works properly before actual deployment.
Content-Type:
application/jsonMethod:
POSTURL:
/api-partner/v1/apps-in-toss/messenger/send-test-message
Request headers
Use one of the two headers below to identify the recipient. Do not send both headers at the same time.
x-toss-user-key
string
Choose 1
Toss Loginreceived with userKeyvalue. Receive user informationcan be obtained through.
Request body
templateSetCode
string
Y
Template code for the message to use. Enter the template code registered in the Console.
deploymentId
string
Y
Identifier of the bundle to use for testing. It is in UUID format and can be seen in the bundle uploaded in Console → App Release.
context
object
Y
These are template variable values. Enter the values that go into the template, such as user name and verification code.
Success response
msgCount
integer
Total number of messages sent.
sentPushCount
integer
Number of messages sent via Push.
sentInboxCount
integer
Number of messages sent via Inbox.
sentSmsCount
integer
Number of messages sent via SMS.
sentAlimtalkCount
integer
Number of messages sent via Alimtalk.
sentFriendtalkCount
integer
Number of messages sent via Friend Talk.
detail
object
Detailed list by channel of messages that were sent successfully.
fail
object
Detailed list by channel of messages that failed to send.
detail / fail Common subfields:
sentPush
array
List of send results for the Push channel.
sentInbox
array
List of send results for the Inbox channel.
sentSms
array
List of send results for the SMS channel.
sentAlimtalk
array
List of send results for the Alimtalk channel.
sentFriendtalk
array
List of send results for the Friend Talk channel.
Item fields in each channel array:
contentId
string
Unique ID of the sent message.
reachedFailReason
string
If message delivery fails, the reason for failure is included.
Failure response
400
The request is invalid or required information is missing.
401
You are an unauthenticated user.
403
You do not have permission to send messages.
2. Send a message
Send a functional message to a specific user. After copy review approval, the partner server can call it directly at the desired time.
Content-Type:
application/jsonMethod:
POSTURL:
/api-partner/v1/apps-in-toss/messenger/send-message
Request headers
Use one of the two headers below to identify the recipient. Do not send both headers at the same time.
x-toss-user-key
string
Choose 1
Toss Loginreceived with userKeyvalue. Receive user informationcan be obtained through.
Request body
templateSetCode
string
Y
Template code for the message to use. Enter the template code registered in the Console.
context
object
Y
These are template variable values. Enter the values that go into the template, such as user name and verification code.
anonKeyWhen sending to x-anon-key use the header.
Success response
The response structure is Send test messagethe same as.
Failure response
400
The request is invalid or required information is missing.
401
You are an unauthenticated user.
403
You do not have permission to send messages.
3. Send bulk messages
Send the same functional message template to multiple users at once. Used for sending 50 or more messages, and up to 2,500 messages can be sent per request.
Content-Type:
application/jsonMethod:
POSTURL:
/api-partner/v1/apps-in-toss/messenger/send-bulk-message
Request body
templateSetCode
string
Y
Template code for the message to use. Enter the template code registered in the Console.
contextList
array
Y
This is the list of users who will receive the message. Minimum 1 and maximum 2,500 items.
contextList Item fields:
userKey
string | number
Conditional Y
Toss Loginreceived with userKeyvalue. Receive user informationcan be obtained through. x-anon-keycannot be used together with.
anonKey
string
Conditional Y
Received through user identification key issuance hash value. userKeycannot be used together with.
context
object
Y
These are template variable values. Enter the values that go into the template, such as user name and verification code.
Each contextList item userKeyand anonKey you must pass one of them.
anonKeyWhen sending to anonKeyput
Success response
The response structure is Send test messagethe same as.
4. Request notification agreement (requestNotificationAgreement)
requestNotificationAgreementis Smart Delivery's functional messagefunction that requests the user's consent UI for receiving notifications before sending.
When the user chooses to receive a specific notification, consent must be obtained first. The consent result is onEvent passed as a callback, and you can decide whether to send the notification based on the result.
Signature
Parameters
params required
These are the parameters used for the notification agreement request. See the detailed type below
RequestNotificationAgreementOptionsfor details.
Return value
() => void
Returns the App Bridge cleanup function. After receiving the consent result, you must call this function to release resources.
Example
RequestNotificationAgreementOptions
requestNotificationAgreement This is the parameter type passed to the function.
options required
This is the options object used for the notification agreement request.
options.templateCode required
This is the template code of the functional campaign linked to the notification agreement. Enter the template code registered in the Console.
onEvent required
This is the callback executed when the consent result is finalized.
NotificationAgreementResulttypetypevalue is passed.onError required
This is the callback executed when an unexpected error occurs. The error object has the type
unknown.
NotificationAgreementResult
onEvent This is the consent result type passed as a callback.
newAgreement
When the user newly completes consent.
alreadyAgreed
When the result is returned with consent already given, without additional consent.
agreementRejected
When the user declines consent.
Error code
The error code is onErrorreceived via or caught in the try/catchof the error caught in error.code value.
UNSUPPORTED_APP_VERSION
If the currently running Toss app version does not support this feature, it occurs immediately upon invocation. Notification.requestAgreement.isSupported()Check in advance with, and when it occurs error.message(update guidance text) to the user.
NOTIFICATION_AGREEMENT_FAILED
Occurs when the functional push template code is incorrect.
The template code must start with {appName}- .
TERMS_DISAGREED_MEMBER
This is the case when the user has refused consent. Go to Settings > Terms and Privacy Policy Consent > User-optimized Product Consent Settings.
Notes
onEventoronErrorBe sure to call the cleanup function returned by the callback.Before re-calling the function in the same component, run the previous cleanup first. Otherwise, the previous event listener may remain duplicated.
For how to register a notification consent statement and the flow for sending functional messages, please refer to the Smart Send introduction document.
To send messages after user consent, on the partner company's server Send Messageplease call it.
Users can directly control whether to receive notifications in the Toss app → All tab → Settings button → Notifications → Service notifications.
Last updated
Was this helpful?