Skip to main content

Transaction SMS Notifications

Transaction SMS Notifications API Requests (Deprecated)​

Send sms notifications to your customer after you have received a payment from them.

POST https://sandbox.kopokopo.com/api/v1/transaction_sms_notifications
Content-Type: application/json
Accept: application/json
Authorization: Bearer < AccessToken >
User-Agent: "< product >/< product-version > < comment >"
{
"webhook_event_reference": "e51438e9-c42b-4bf2-a261-faeaf189e3ed",
"message": "Your message here",
"_links": {
"callback_url": "https://webhook.site/a67f60b8-8c26-40a2-866c-99f5314a3e0e"
}
}

HTTP Request​

POST https://sandbox.kopokopo.com/api/v1/transaction_sms_notifications
Accept: application/json
Content-Type: application/json
Authorization: Bearer 0Sn0W6kzNicvoWhDbQcVSKLRUpGjIdlPSEYyrHqrDDoRnQwE7Q
User-Agent: < product >/< product-version > < comment >

Request Parameters (JSON)​

ParameterRequiredTypeDescription
webhook_event_referenceyesStringThis is the id of the webhook payload you got
messageYesStringA string containing the message you want to send to the customer
_linksYesJSONA JSON object containing the callback_url where the result of the Transaction Notification will be posted

HTTP Response​

Successful Response​

Upon a successful request a HTTP Status 201 will be returned and the location HTTP Header will contain the URL of the newly created Transaction Notification API Request

HTTP/1.1 201 Created
Location: https://sandbox.kopokopo.com/api/v1/transaction_sms_notifications/247b1bd8-f5a0-4b71-a898-f62f67b8ae1c

Error Response​

This will have a HTTP Status code indicating the error and it might have a json that contains the error code and an error message specifying the error that occured. Please note that the error response might not be present depending on the type of error that occured.

If the error json response is present, it will look as follows:

HTTP/1.1 400 Bad Request

{ "error_code": 400, "error_message": "Message can't be blank" }

Process Transaction Notification API Result​

POST https://your-callback-url.com/api/v1/transaction_notification_result
Content-Type: application/json
X-KopoKopo-Signature: 0Sn0W6kzNicvoWhDbQcVSKLRUpGjIdlPSEYyrHqrDDoRnQwE7Q
User-Agent: < product >/< product-version > < comment >
{
"data": {
"id": "a48ad0a7-b43b-48c5-9ff8-509552d603af",
"type": "transaction_sms_notification",
"attributes": {
"status": "Success",
"message": "Your message here",
"webhook_event_reference": "4b46f88a-31f6-4af2-8795-b11ef1f3b846",
"_links": {
"callback_url": "https://webhook.site/a67f60b8-8c26-40a2-866c-99f5314a3e0e",
"self": "https://sandbox.kopokopo.com/api/v1/transaction_sms_notifications/a48ad0a7-b43b-48c5-9ff8-509552d603af"
}
}
}
}

After the transaction notification is sent, a Transaction Notification Result will be posted asynchronously to the call back URL specified in the Transaction Notification request.

Transaction Notification Result Parameters (JSON)​

Parameters contained in a transaction notification result;

ParameterRequiredTypeDescription
idYesStringThe ID of the Transaction Notification API Request
typeYesStringThe topic of the request. transaction_sms_notifications in this instance.
statusYesStringA status string denoting the status of the Transaction Notification Request
messageYesStringA string containing the message you sent
webhook_event_referenceNoStringAn JSON object containing the transactions from the query with the specified parameters
_linksYesJSONA JSON object containing links to the Transaction Notification API request

Query Transaction Notification API Status​

GET https://sandbox.kopokopo.com/api/v1/transaction_sms_notifications/d79995cd-0111-e511-80da-0aa34a9b2388
Accept: application/json
Authorization: Bearer 0Sn0W6kzNicvoWhDbQcVSKLRUpGjIdlPSEYyrHqrDDoRnQwE7Q
Content-Type: application/json
User-Agent: < product >/< product-version > < comment >
notification_url = 'https://sandbox.kopokopo.com/api/v1/transaction_sms_notifications/a48ad0a7-b43b-48c5-9ff8-509552d603af'

# Using K2 Connect - https://github.com/kopokopo/k2-connect-ruby (Recommended)
k2_notification = k2Notification.new("your_access_token")
k2_notification.transaction_sms_notifications(your_input)

# Query specific resource
k2_notification.query_resource(notification_url) or k2_notification.query_resource(k2_notification.location_url)

# Query recent transaction
k2_notification.query_status

The request above results the following JSON payload when a Transaction Notification Result exists

{
"data": {
"id": "a48ad0a7-b43b-48c5-9ff8-509552d603af",
"type": "transaction_sms_notification",
"attributes": {
"status": "Success",
"message": "Your message here",
"webhook_event_reference": "4b46f88a-31f6-4af2-8795-b11ef1f3b846",
"_links": {
"callback_url": "https://webhook.site/a67f60b8-8c26-40a2-866c-99f5314a3e0e",
"self": "https://sandbox.kopokopo.com/api/v1/transaction_sms_notifications/a48ad0a7-b43b-48c5-9ff8-509552d603af"
}
}
}
}

With an Transaction Sms Notification location url, you can query what the status of the Transaction Notification is. If a corresponding Transaction Sms Notification Result exists, it will be bundled in the payload of the result.

HTTP Request​

GET https://sandbox.kopokopo.com/api/v1/transaction_sms_notifications/
Accept: application/json
Content-Type: application/json
Authorization: Bearer 0Sn0W6kzNicvoWhDbQcVSKLRUpGjIdlPSEYyrHqrDDoRnQwE7Q
User-Agent: < product >/< product-version > < comment >

Query Parameters​

ParameterRequiredTypeDescription
IDYesStringThe reference / ID of the Transaction Sms Notification to retrieve