### Example Response for List All Main Actions Source: https://github.com/kangaroorewards/api-docs/wiki/Workflows-‐-Getting-started This is an example of the JSON response structure when listing all main actions, showing each action's ID and name. ```json { "data": [ { "id": 1, "action_name": "Email" }, { "id": 2, "action_name": "Send SMS" }, { "id": 3, "action_name": "Reward Points" }, { "id": 4, "action_name": "Wait" } ] } ``` -------------------------------- ### Get Customer Offers Source: https://github.com/kangaroorewards/api-docs/wiki/Transaction-‐-Redeem-Offers Retrieve a list of offers available for a specific customer. Replace placeholders with actual access token, X-Application-Key, and customer ID. ```bash curl -X GET https://api.kangaroorewards.com/customers//offers \ -H "Authorization: Bearer " \ -H "X-Application-Key: " \ -H "Accept: application/vnd.kangaroorewards.api.v1+json" \ -H "Content-Type: application/json" \ ``` -------------------------------- ### Example JSON Response for Customer Consent Source: https://github.com/kangaroorewards/api-docs/wiki/Customers-‐-Customer-Consent This is an example of the JSON structure returned when retrieving customer consent data. ```json { "data": { "id": 123, "allow_sms": false, "allow_email": true, "allow_push": true } } ``` -------------------------------- ### Handle API Response in Shell Script Source: https://github.com/kangaroorewards/api-docs/wiki/Customers-‐-Customer-Consent Capture the API response in a shell variable and echo it to the console. This example demonstrates handling a GET request response. ```bash response=$(curl -X GET "https://api.kangaroorewards.com/customers/{customer_id}/consents" \ -H "Authorization: Bearer $ACCESS_KEY" \ -H "X-Application-Key: $APPLICATION_KEY" \ -H "Accept: application/vnd.kangaroorewards.api.v1+json;" \ -H "Content-Type: application/json") echo "Response: $response" ``` -------------------------------- ### List All Product Rewards Source: https://github.com/kangaroorewards/api-docs/wiki/Product-Rewards-‐-List Make a GET request to the product-rewards endpoint to retrieve a list of all available product rewards. Ensure you include the Authorization and X-Application-Key headers. ```bash curl -X GET "https://api.kangaroorewards.com/product-rewards" \ -H "Authorization: Bearer " \ -H "X-Application-Key: " \ -H "Accept: application/vnd.kangaroorewards.api.v1+json;" \ -H "Content-Type: application/json" \ ``` -------------------------------- ### Get Customer Offers Source: https://github.com/kangaroorewards/api-docs/wiki/Transaction-‐-Redeem-Offers Retrieve a list of offers available for a specific customer. This is a prerequisite step before retrieving coupons. ```APIDOC ## GET /customers//offers ### Description Retrieves a list of offers available for a specific customer. ### Method GET ### Endpoint https://api.kangaroorewards.com/customers//offers ### Parameters #### Path Parameters - **customer_id** (string) - Required - The unique identifier for the customer. #### Headers - **Authorization**: Bearer - Required - Authentication token. - **X-Application-Key**: - Required - Your application's key. - **Accept**: application/vnd.kangaroorewards.api.v1+json - Required - **Content-Type**: application/json - Required ### Response #### Success Response (200) - Offers data for the customer. ``` -------------------------------- ### Example Response for List All Main Triggers Source: https://github.com/kangaroorewards/api-docs/wiki/Workflows-‐-Getting-started This JSON structure illustrates the response for listing main triggers, including their IDs, names, and configurable conditions like branch or specific days. ```json { "data": [ { "id": 1, "trigger_name": "Created Account", "conditions": [ { "id": 1, "type": "list", "label": "Branch", "url": "https://api.kangaroorewards.com/branches?include=virtual_branch", "relations": null }, { "id": 2, "type": "list", "label": "Specific Day", "url": null, "relations": [ { "label": "Monday", "value": 1 }, { "label": "Tuesday", "value": 2 }, { "label": "Wednesday", "value": 3 }, { "label": "Thursday", "value": 4 }, { "label": "Friday", "value": 5 }, { "label": "Saturday", "value": 6 }, { "label": "Sunday", "value": 7 } ] } ] } ] } ``` -------------------------------- ### Get Customer Offers Source: https://github.com/kangaroorewards/api-docs/wiki/Transaction-‐-Redeem-Offer-(Ecom) Fetch the offers available for a specific customer, including their relationships with branches. ```APIDOC ## Get Customer Offers ### Description Retrieves all offers associated with a customer, including branch information. ### Method GET ### Endpoint https://api.kangaroorewards.com/customers//offers?relationships=branches ### Headers - Authorization: Bearer - X-Application-Key: - Accept: application/vnd.kangaroorewards.api.v1+json - Content-Type: application/json ### Notes - Ensure the offer is available at the specified branch when redeeming. - Replace `` with the actual customer ID. ``` -------------------------------- ### Get customer offers using Offers API Source: https://github.com/kangaroorewards/api-docs/wiki/Transaction-‐-Redeem-Offer-(Ecom) Fetch available offers for a specific customer. Ensure the offer is valid for the target branch. Requires customer ID, access token, and X-Application-Key. ```bash curl -X GET https://api.kangaroorewards.com/customers//offers?relationships=branches \ -H "Authorization: Bearer " \ -H "X-Application-Key: " \ -H "Accept: application/vnd.kangaroorewards.api.v1+json" \ -H "Content-Type: application/json" \ ``` -------------------------------- ### List All Main Actions using curl Source: https://github.com/kangaroorewards/api-docs/wiki/Workflows-‐-Getting-started Make a GET request to the /workflow-main-actions endpoint with your access token and application key to retrieve a list of available main actions. The response is a JSON object containing an array of actions. ```bash curl -X GET https://api.kangaroorewards.com/workflow-main-actions \ -H "Authorization: Bearer " \ -H "X-Application-Key: " \ -H "Accept: application/vnd.kangaroorewards.api.v1+json;" \ -H "Content-Type: application/json" ``` -------------------------------- ### Handle Token Response (JSON) Source: https://github.com/kangaroorewards/api-docs/wiki/Implement-OAuth2-Authentication This is an example of a successful JSON response when requesting an access token. It includes the access token, refresh token, expiration time, and token type. ```json { "access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImI5ZTk0NTRkYTRmOTY5Y2U2ZTUxMmFlMTRkZTdkMWJhZWQ", "refresh_token":"2riNuUlbhlW1MWKb4Jos9FOYgIzz5ZJtK7rQjIgLD", "expires_in":3920, "token_type":"Bearer" } ``` -------------------------------- ### List Customer CRM Fields Source: https://github.com/kangaroorewards/api-docs/wiki/Customer-CRM-Fields-‐-List Make a GET request to the customer CRM fields endpoint. Ensure you include your access token and X-Application-Key in the headers. ```bash curl -X GET "https://api.kangaroorewards.com/customers/11eb5b4433edf7bfaaffb42e99312ac8/crm-fields" \ -H "Authorization: Bearer " \ -H "X-Application-Key: " \ -H "Accept: application/vnd.kangaroorewards.api.v1+json;" \ -H "Content-Type: application/json" \ ``` -------------------------------- ### Retrieve Customer Consent Source: https://github.com/kangaroorewards/api-docs/wiki/Customers-‐-Customer-Consent Send a GET request to the /customers/{customer_id}/consents endpoint to retrieve a customer's consent. Include authentication and accept headers. ```bash curl -X GET "https://api.kangaroorewards.com/customers/{customer_id}/consents" \ -H "Authorization: Bearer $ACCESS_KEY" \ -H "X-Application-Key: $APPLICATION_KEY" \ -H "Accept: application/vnd.kangaroorewards.api.v1+json;" \ -H "Content-Type: application/json" ``` -------------------------------- ### List All Workflows using curl Source: https://github.com/kangaroorewards/api-docs/wiki/Workflows-‐-Getting-started Retrieve a list of all defined workflows by making a GET request to the /workflows endpoint. Include your access token and application key, and specify desired inclusions like triggers and actions in the query parameters. ```bash curl -X GET https://api.kangaroorewards.com/workflows?include=triggers,actions \ -H "Authorization: Bearer " \ -H "X-Application-Key: " \ -H "Accept: application/vnd.kangaroorewards.api.v1+json;" \ -H "Content-Type: application/json" ``` -------------------------------- ### Product Rewards API Response Example Source: https://github.com/kangaroorewards/api-docs/wiki/Product-Rewards-‐-List This JSON object represents a successful response from the product rewards API, listing available product rewards with their associated points and product details. It includes pagination information. ```json { "data": [ { "id": 123, "points": 50, "product": { "id": 456, "title": "Sample product", "description": "Description of the product", "images": [], "product_sku": "SKU123", "actual_price": 19.99, "real_price": 19.99, "terms_conditions": "", "link": "", "product_languages": [ { "language_id": 1, "title": "Sample product", "description": "Description of the product", "terms_conditions": null, "link": null, "language": { "id": 1, "abbreviation": "en", "name": "English" } } ] } } ], "links": { "first": "https://api.kangaroorewards.com/product-rewards?page=1", "last": null, "prev": null, "next": null }, "meta": { "current_page": 1, "from": 1, "path": "https://api.kangaroorewards.com/product-rewards", "per_page": 15, "to": 1 } } ``` -------------------------------- ### Retrieve Available Tags Source: https://github.com/kangaroorewards/api-docs/wiki/Customer-CRM-Fields-‐-Update Optionally, list all available tags in the system by making a GET request. This helps in identifying the 'name' attribute for tags to be added to customer CRM fields. ```bash curl -X GET "https://api.kangaroorewards.com/tags" \ -H "Authorization: Bearer " \ -H "X-Application-Key: " \ -H "Accept: application/vnd.kangaroorewards.api.v1+json;" \ -H "Content-Type: application/json" \ ``` -------------------------------- ### List All Main Triggers using curl Source: https://github.com/kangaroorewards/api-docs/wiki/Workflows-‐-Getting-started Send a GET request to the /workflow-main-triggers endpoint, including your access token and application key, to fetch a list of all available main triggers. The response details trigger IDs, names, and associated conditions. ```bash curl -X GET https://api.kangaroorewards.com/workflow-main-triggers\ -H "Authorization: Bearer " \ -H "X-Application-Key: " \ -H "Accept: application/vnd.kangaroorewards.api.v1+json;" \ -H "Content-Type: application/json" ``` -------------------------------- ### Make Authenticated API Call (cURL) Source: https://github.com/kangaroorewards/api-docs/wiki/Implement-OAuth2-Authentication Use this cURL command to make authenticated GET requests to the customers endpoint. Ensure you replace placeholders with your actual access token and application key. ```bash curl -X GET "https://api.kangaroorewards.comm/customers" \ -H "Accept: Bearer application/vnd.kangaroorewards.api.v1+json;" \ -H "Content-Type: application/json; charset=UTF-8" \ -H "X-Application-Key: Bearer YOUR_APPLICATION_KEY" \ -H "Authorization: Bearer ACCESS_TOKEN" ``` -------------------------------- ### Create a Customer with Referral Details Source: https://github.com/kangaroorewards/api-docs/wiki/Reward-Customers-Based-on-Referral Make a POST request to the customers endpoint to create a new customer, including their referral program ID and the referrer's ID. Ensure you have a valid Access Token and X-Application-Key. ```bash curl -X POST "https://api.kangaroorewards.com/customers" \ -H "Authorization: Bearer " \ -H "X-Application-Key: " \ -H "Accept: application/vnd.kangaroorewards.api.v1+json;" \ -H "Content-Type: application/json" \ -d '{ "first_name":"John", "last_name": "Doe", "email": "john@example.com", "referral": { "referral_program_id": 1056, "referrer_id": "11eaa697ae8f46bd9df9b42e99312ac8" } }' ``` -------------------------------- ### Generate API Documentation HTML Source: https://github.com/kangaroorewards/api-docs/blob/master/README.md Use this command to generate a full-width HTML documentation page from an API Blueprint file. ```bash aglio --theme-full-width --theme-template triple -i api.apib -o docs.html ``` -------------------------------- ### Get Available Coupons Source: https://github.com/kangaroorewards/api-docs/wiki/Transaction-‐-Redeem-Offers Retrieve the coupons that are available for a customer for a given offer. This step is necessary to get the coupon ID for redemption. ```APIDOC ## GET /customers//available-coupons ### Description Retrieves a list of coupons available for a specific customer. ### Method GET ### Endpoint https://api.kangaroorewards.com/customers//available-coupons ### Parameters #### Path Parameters - **customer_id** (string) - Required - The unique identifier for the customer. #### Headers - **Authorization**: Bearer - Required - Authentication token. - **X-Application-Key**: - Required - Your application's key. - **Accept**: application/vnd.kangaroorewards.api.v1+json - Required - **Content-Type**: application/json - Required ### Response #### Success Response (200) - A list of available coupons, including their offer IDs. ``` -------------------------------- ### Create an Integration Source: https://github.com/kangaroorewards/api-docs/wiki/Integration-‐-Connect-Integrations Create a new integration for your business. You must provide a name and type. Type `1` is for POS/Ecommerce integrations. The response will contain the `integration_id` needed for further steps. Replace placeholders with your actual access token and application key. ```bash curl -X POST https://integrations.kangarooapis.com/api/v1/integrations \ -H "Authorization: Bearer " \ -H "X-Application-Key: " \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -D '{ "name": "ABC", "type": 1 }' ``` -------------------------------- ### Get Coupon Transaction Source: https://github.com/kangaroorewards/api-docs/wiki/Transaction-‐-Redeem-Offers Initiate a transaction to get a coupon for a specific offer if one is not already available. This is typically used when a customer needs to be assigned a coupon. ```APIDOC ## POST /transactions (Get Coupon) ### Description Initiates a transaction to assign a coupon to a customer for a given offer. ### Method POST ### Endpoint https://api.kangaroorewards.com/transactions ### Headers - **Authorization**: Bearer - Required - Authentication token. - **X-Application-Key**: - Required - Your application's key. - **Accept**: application/vnd.kangaroorewards.api.v1+json - Required - **Content-Type**: application/json - Required ### Request Body - **intent** (string) - Required - Must be "get_coupon". - **offer** (object) - Required - **id** (integer) - Required - The ID of the offer for which to get a coupon. - **branch** (object) - Optional - **id** (string) - The ID of the branch associated with the transaction. - **customer** (object) - Required - **id** (string) - Required if email and phone are not present - The customer's unique identifier. - **email** (string) - Required if id and phone are not present - The customer's email address. - **phone** (string) - Required if id and email are not present - The customer's phone number. ### Request Example ```json { "intent": "get_coupon", "offer": { "id": 2305 }, "branch": { "id": "11eb82ae6d3f1ec4b847e2865c66d9cc" }, "customer": { "id": "11eea0e1e994d24d9fede2865c66d9cc" } } ``` ### Response #### Success Response (200) - Contains the coupon ID if successfully obtained. ``` -------------------------------- ### Generate API Documentation HTML in Specific Folder Source: https://github.com/kangaroorewards/api-docs/blob/master/README.md Use this command to generate a full-width HTML documentation page and specify the output file name. ```bash aglio --theme-full-width --theme-template triple -i api.apib -o business.html ``` -------------------------------- ### Example API Response for Branch Link Source: https://github.com/kangaroorewards/api-docs/wiki/Integration-‐-Connect-Integrations This is an example of a successful response when linking an integration to a virtual branch. The `id` field, also known as `branch_link_id`, should be stored for subsequent API operations. ```json { "id": 1, "account_id": "string", "shop_id": "string", "store_name": "string", "store_domain": "http://example.com", "integration_id": 1, "branch_id": "string", "created_at": "2019-08-24T14:15:22Z", "enabled": true } ``` -------------------------------- ### Get Social Media Call to Action List using cURL Source: https://github.com/kangaroorewards/api-docs/wiki/Social-Media-‐-Delete-Social-Media-Call-to-Action Retrieve a list of all created Social Media Call to Actions by making a GET request to the specified endpoint. Ensure you include the necessary Authorization and X-Application-Key headers. ```bash curl -X GET "https://api.kangaroorewards.com/call-to-actions" \ -H "Authorization: Bearer " \ -H "X-Application-Key: " \ -H "Accept: application/vnd.kangaroorewards.api.v1+json;" \ -H "Content-Type: application/json" \ ``` ```json { "data": [ { "id": 489, "enabled": true, "points": 100, "result_freq": null, "result_count": 0, "action_freq": null, "action_count": 1, "action_duration_min": 0, "action_duration_unit": null, "conditions": null, "action_id": 4, "created_at": "2024-11-08T09:22:55+00:00" }, { "id": 487, "enabled": true, "points": 0, "result_freq": null, "result_count": 1, "action_freq": null, "action_count": 1, "action_duration_min": 0, "action_duration_unit": null, "conditions": null, "action_id": 8, "created_at": "2024-11-08T08:49:16+00:00" }, { "id": 486, "enabled": true, "points": 25, "result_freq": null, "result_count": 1, "action_freq": null, "action_count": 1, "action_duration_min": 0, "action_duration_unit": null, "conditions": null, "action_id": 7, "created_at": "2024-11-08T08:49:16+00:00" }, { "id": 485, "enabled": true, "points": 5, "result_freq": null, "result_count": 1, "action_freq": null, "action_count": 1, "action_duration_min": 0, "action_duration_unit": null, "conditions": null, "action_id": 6, "created_at": "2024-11-08T08:49:16+00:00" }, ], } ``` -------------------------------- ### Create a Referral Program via API Source: https://github.com/kangaroorewards/api-docs/wiki/Create-Referral-Program Make a POST request to the referral-programs endpoint with referral program details in the JSON body. The previous active program will be deactivated, and the new one enabled upon successful creation. ```bash curl -X POST "https://api.kangaroorewards.com/referral-programs" \ -H "Authorization: Bearer " \ -H "X-Application-Key: " \ -H "Accept: application/vnd.kangaroorewards.api.v1+json;" \ -H "Content-Type: application/json" \ -d '{ \ "cond_min_amount": 30.00, \ "referee_earns": 50, \ "referer_earns": 10, \ "expires_in": 35, \ "enabled": true, \ "link_referral_enabled": true, \ }' ``` -------------------------------- ### Get Available Coupons Source: https://github.com/kangaroorewards/api-docs/wiki/Transaction-‐-Redeem-Offer-(Ecom) Retrieve a list of coupons that are currently available for a specific customer. ```APIDOC ## Get Available Coupons ### Description Fetches the coupons that a customer is eligible to use. ### Method GET ### Endpoint https://api.kangaroorewards.com/customers//available-coupons ### Headers - Authorization: Bearer - X-Application-Key: - Accept: application/vnd.kangaroorewards.api.v1+json - Content-Type: application/json ### Notes - Replace `` with the actual customer ID. ``` -------------------------------- ### Create a Reward Transaction with Product Rewards Source: https://github.com/kangaroorewards/api-docs/wiki/Transaction-‐-Reward-with-Product-Rewards Send a POST request to the transactions endpoint to create a reward transaction. Include the intent, amount, customer details, and a list of product rewards with their IDs and quantities. ```bash curl -X POST https://api.kangaroorewards.com/transactions \ -H "Authorization: Bearer " \ -H "X-Application-Key: " \ -H "Accept: application/vnd.kangaroorewards.api.v1+json" \ -H "Content-Type: application/json" \ -d '{ "intent": "reward", "amount": 50.55, "branch": { "id": "11eb82ae6d3f1ec4b847e2865c66d9cc" }, "customer": { "email": "test@example.com" }, "product_rewards": [ { "id": 123, "quantity": 3 }, { "id": 124, "quantity": 1 } ] }' ``` -------------------------------- ### Get Product Rewards Source: https://github.com/kangaroorewards/api-docs/wiki/Product-Rewards-‐-List This endpoint retrieves a list of product rewards. The response includes details about each reward and its associated product. ```APIDOC ## GET /product-rewards ### Description Retrieves a list of product rewards available in the system. This endpoint allows users to fetch reward information associated with various products. ### Method GET ### Endpoint /product-rewards ### Response #### Success Response (200) - **data** (array) - An array of product reward objects. - **id** (integer) - The unique identifier for the product reward. - **points** (integer) - The number of reward points associated with the product. - **product** (object) - An object containing details about the product. - **id** (integer) - The unique identifier for the product. - **title** (string) - The title or name of the product. - **description** (string) - A description of the product. - **images** (array) - An array of image URLs for the product. - **product_sku** (string) - The stock keeping unit (SKU) of the product. - **actual_price** (number) - The original price of the product. - **real_price** (number) - The current price of the product. - **terms_conditions** (string) - Terms and conditions for the product. - **link** (string) - A link to the product. - **product_languages** (array) - An array of language-specific product details. - **language_id** (integer) - The ID of the language. - **title** (string) - The title of the product in the specified language. - **description** (string) - The description of the product in the specified language. - **terms_conditions** (string) - Terms and conditions in the specified language. - **link** (string) - A link to the product in the specified language. - **language** (object) - Details about the language. - **id** (integer) - The ID of the language. - **abbreviation** (string) - The abbreviation of the language. - **name** (string) - The name of the language. - **links** (object) - Pagination links. - **first** (string) - URL to the first page of results. - **last** (string) - URL to the last page of results. - **prev** (string) - URL to the previous page of results. - **next** (string) - URL to the next page of results. - **meta** (object) - Metadata about the pagination. - **current_page** (integer) - The current page number. - **from** (integer) - The starting item number on the current page. - **path** (string) - The base path for the API endpoint. - **per_page** (integer) - The number of items per page. - **to** (integer) - The ending item number on the current page. ### Response Example { "data": [ { "id": 123, "points": 50, "product": { "id": 456, "title": "Sample product", "description": "Description of the product", "images": [], "product_sku": "SKU123", "actual_price": 19.99, "real_price": 19.99, "terms_conditions": "", "link": "", "product_languages": [ { "language_id": 1, "title": "Sample product", "description": "Description of the product", "terms_conditions": null, "link": null, "language": { "id": 1, "abbreviation": "en", "name": "English" } } ] } } ], "links": { "first": "https://api.kangaroorewards.com/product-rewards?page=1", "last": null, "prev": null, "next": null }, "meta": { "current_page": 1, "from": 1, "path": "https://api.kangaroorewards.com/product-rewards", "per_page": 15, "to": 1 } } ``` -------------------------------- ### Referral Program Creation Response Sample Source: https://github.com/kangaroorewards/api-docs/wiki/Create-Referral-Program This JSON structure represents a successful response after creating a new referral program, detailing its configuration and unique identifier. ```json { "data": { "id": 1370, "rule_name": "BACKEND_REFERRAL_RULES_PURCHASE", "cond_min_amount": 30, "referee_earns": 50, "referer_earns": 10, "expires_in": 35, "enabled": true, "link_referral_enabled": true, "referral_link": "" } } ``` -------------------------------- ### Get Branches Source: https://github.com/kangaroorewards/api-docs/wiki/Integration-‐-Connect-Integrations Retrieve a list of all branches associated with your account. You will need to identify the virtual branch ID from the response to proceed with integration. ```APIDOC ## GET /api/v1/branches ### Description Retrieves a list of all branches. This is used to find the ID of the virtual branch where the integration will be connected. ### Method GET ### Endpoint https://integrations.kangarooapis.com/api/v1/branches ### Parameters #### Header Parameters - **Authorization** (string) - Required - Bearer token for authentication. - **X-Application-Key** (string) - Required - Your application's unique key. - **Accept** (string) - Optional - `application/json` - **Content-Type** (string) - Optional - `application/json` ### Response #### Success Response (200) - **branches** (array) - A list of branch objects. Each object contains branch details, including `virtual_branch_flag`. #### Response Example ```json { "branches": [ { "id": "branch_id_1", "name": "Virtual Branch 1", "virtual_branch_flag": true }, { "id": "branch_id_2", "name": "Physical Store 1", "virtual_branch_flag": false } ] } ``` ``` -------------------------------- ### List Product Rewards with Product Details Source: https://github.com/kangaroorewards/api-docs/wiki/Product-Rewards-‐-List Include product details in the response by specifying 'product' in the relationships query parameter. This enhances the returned data with associated product information. ```bash curl -X GET "https://api.kangaroorewards.com/product-rewards?relationships=product" \ -H "Authorization: Bearer " \ -H "X-Application-Key: " \ -H "Accept: application/vnd.kangaroorewards.api.v1+json;" \ -H "Content-Type: application/json" ``` -------------------------------- ### Get eCom Branch ID Source: https://github.com/kangaroorewards/api-docs/wiki/Transaction-‐-Redeem-Offer-(Ecom) Retrieve the eCom branch ID by querying the branches API. Look for the branch with `virtual_branch_flag` set to true. ```APIDOC ## Get eCom Branch ID ### Description Retrieves a list of branches, including virtual ones, to identify the eCom branch. ### Method GET ### Endpoint https://api.kangaroorewards.com/branches?include=virtual_branch ### Headers - Authorization: Bearer - X-Application-Key: - Accept: application/vnd.kangaroorewards.api.v1+json - Content-Type: application/json ``` -------------------------------- ### Create a Workflow using cURL Source: https://github.com/kangaroorewards/api-docs/wiki/Workflows-‐-Getting-started Use this cURL command to send a POST request to create a new workflow. Ensure you replace placeholders like and with your actual credentials. The request body defines the workflow's name, schedule, triggers, and actions. ```bash curl -X POST https://api.kangaroorewards.com/workflows \ -H "Authorization: Bearer " \ -H "X-Application-Key: " \ -H "Accept: application/vnd.kangaroorewards.api.v1+json" \ -H "Content-Type: application/json" \ -d '{ "name": "Example Flow", "published_at": "2024-01-01 08:00:00", "expires_at": "2028-12-31 23:00:00", "targeted_flag": 0, "triggers": [ { "main_trigger_id": 1, "frequency": { "freq": "hourly", "interval": 1 }, "conditions": [ { "id": 1, "operator": "eq", "value": "123" } ] } ], "actions": [ { "main_action_id": 1, "name": "Example action", "action_key": "abc123", "enabled": true, "temp_id": 2, "temp_parent_id": 1, "relations": { "entity_id": 1, "entity_type": "Transaction", "value": "123", "label": "Transaction Type" } } ] }' ``` -------------------------------- ### Get eCom Branch ID Source: https://github.com/kangaroorewards/api-docs/wiki/Transaction-‐-Redeem-Redemption-Catalog-(Ecom) Retrieve the eCom branch ID by querying the branches API. This is necessary to identify the correct branch for redemption. ```APIDOC ## Get eCom Branch ID ### Description Retrieves a list of branches, including virtual ones, to identify the eCom branch. ### Method GET ### Endpoint https://api.kangaroorewards.com/branches?include=virtual_branch ### Headers - Authorization: Bearer - X-Application-Key: - Accept: application/vnd.kangaroorewards.api.v1+json - Content-Type: application/json ### Notes Loop through the branches in the response to find the eCom branch, which has `virtual_branch_flag` set to true. ``` -------------------------------- ### Get Social Media Call to Action List Source: https://github.com/kangaroorewards/api-docs/wiki/Social-Media-‐-Delete-Social-Media-Call-to-Action Retrieve a list of all created Social Media Call to Actions. This is a prerequisite to deleting a specific one. ```APIDOC ## GET /call-to-actions ### Description Retrieves a list of all social media call to actions. ### Method GET ### Endpoint https://api.kangaroorewards.com/call-to-actions ### Headers - Authorization: Bearer - X-Application-Key: - Accept: application/vnd.kangaroorewards.api.v1+json - Content-Type: application/json ### Response #### Success Response (200) - data (array) - An array of social media call to action objects. - id (integer) - The unique identifier for the call to action. - enabled (boolean) - Indicates if the call to action is currently enabled. - points (integer) - The points awarded for completing the call to action. - result_freq (null) - Placeholder for frequency of results. - result_count (integer) - The count of results. - action_freq (null) - Placeholder for action frequency. - action_count (integer) - The count of actions. - action_duration_min (integer) - Minimum duration for the action. - action_duration_unit (null) - Unit of action duration. - conditions (null) - Conditions for the call to action. - action_id (integer) - The ID of the associated action. - created_at (string) - Timestamp of creation. ### Request Example ```bash curl -X GET "https://api.kangaroorewards.com/call-to-actions" \ -H "Authorization: Bearer " \ -H "X-Application-Key: " \ -H "Accept: application/vnd.kangaroorewards.api.v1+json;" \ -H "Content-Type: application/json" \ ``` ### Response Example ```json { "data": [ { "id": 489, "enabled": true, "points": 100, "result_freq": null, "result_count": 0, "action_freq": null, "action_count": 1, "action_duration_min": 0, "action_duration_unit": null, "conditions": null, "action_id": 4, "created_at": "2024-11-08T09:22:55+00:00" } ] } ``` ``` -------------------------------- ### Create a Referral Reward Transaction Source: https://github.com/kangaroorewards/api-docs/wiki/Reward-Customers-Based-on-Referral Make a POST request to the transactions endpoint to create a reward transaction for a referred customer. Specify the intent as 'reward_referral', the amount, and the customer's ID or email/phone. ```bash curl -X POST "https://api.kangaroorewards.com/transactions" \ -H "Authorization: Bearer " \ -H "X-Application-Key: " \ -H "Accept: application/vnd.kangaroorewards.api.v1+json;" \ -H "Content-Type: application/json" \ -d '{ "intent": "reward_referral", "amount":40.99, "customer": { "id": "11eaa697ae8f46bd9df9b42e99312ac8" } }' ``` -------------------------------- ### Get Social Media Call to Action List Source: https://github.com/kangaroorewards/api-docs/wiki/Social-Media-‐-Update-Social-Media-Call-to-Action Retrieves a list of all created Social Media Call to Actions. This endpoint is useful for identifying the `call_to_action_id` needed for updates. ```APIDOC ## GET /call-to-actions ### Description Retrieves a list of all created Social Media Call to Actions. ### Method GET ### Endpoint https://api.kangaroorewards.com/call-to-actions ### Headers - Authorization: Bearer - X-Application-Key: - Accept: application/vnd.kangaroorewards.api.v1+json - Content-Type: application/json ### Response #### Success Response (200) - **data** (array) - An array of social media call to action objects. - **id** (integer) - The unique identifier for the call to action. - **enabled** (boolean) - Indicates if the call to action is active. - **points** (integer) - The points awarded for completing the action. - **result_freq** (null) - Frequency of results (currently null). - **result_count** (integer) - Number of results. - **action_freq** (null) - Frequency of action (currently null). - **action_count** (integer) - Number of times the action can be performed. - **action_duration_min** (integer) - Minimum duration for the action in minutes. - **action_duration_unit** (null) - Unit for action duration (currently null). - **conditions** (null) - Conditions for the call to action (currently null). - **action_id** (integer) - The ID of the associated action. - **created_at** (string) - Timestamp of creation. ### Response Example ```json { "data": [ { "id": 489, "enabled": true, "points": 100, "result_freq": null, "result_count": 0, "action_freq": null, "action_count": 1, "action_duration_min": 0, "action_duration_unit": null, "conditions": null, "action_id": 4, "created_at": "2024-11-08T09:22:55+00:00" } ] } ``` ``` -------------------------------- ### Set Environment Variables for API Access Source: https://github.com/kangaroorewards/api-docs/wiki/Reward-Customers-Based-on-Referral Set your API access key and X-Application-Key as environment variables. These are necessary for authenticating your API requests. ```bash export ACCESS_KEY="YOUR_ACCESS_KEY_HERE" export APPLICATION_KEY="YOUR_APPLICATION_KEY_HERE" ``` -------------------------------- ### List CRM fields for a customer Source: https://github.com/kangaroorewards/api-docs/wiki/Customer-CRM-Fields-‐-List Retrieve the customer's CRM fields by making a GET request to the specified endpoint. Ensure you include the necessary authorization headers. ```APIDOC ## GET /customers/{customerId}/crm-fields ### Description Retrieves the CRM fields associated with a specific customer. ### Method GET ### Endpoint /customers/{customerId}/crm-fields ### Parameters #### Path Parameters - **customerId** (string) - Required - The unique identifier of the customer. #### Headers - **Authorization** (string) - Required - Bearer token for authentication. Example: `Bearer ` - **X-Application-Key** (string) - Required - Your application's key. - **Accept** (string) - Required - Specifies the API version. Example: `application/vnd.kangaroorewards.api.v1+json;` - **Content-Type** (string) - Required - Indicates the request body format. Example: `application/json` ### Response #### Success Response (200) Returns a JSON object containing an array of CRM fields for the customer. - **data** (array) - An array of CRM field objects. - **name** (string) - The internal name of the CRM field. - **label** (string) - The display label for the CRM field. - **value** (any) - The current value of the CRM field for the customer. - **is_hidden** (boolean) - Indicates if the field is hidden. - **is_required** (boolean) - Indicates if the field is required. - **field_type** (string) - The type of the CRM field (e.g., 'text', 'select', 'checkbox'). - **is_custom_field** (boolean) - Indicates if this is a custom field. - **display_order** (integer) - The order in which the field should be displayed. ### Response Example ```json { "data": [ { "name": "first_name", "label": "First Name", "value": "John", "is_hidden": false, "is_required": false, "field_type": "text", "is_custom_field": false, "display_order": 3 }, { "name": "last_name", "label": "Last Name", "value": "Doe", "is_hidden": false, "is_required": false, "field_type": "text", "is_custom_field": false, "display_order": 4 } ] } ``` ``` -------------------------------- ### Create Social Media Call to Action via API Source: https://github.com/kangaroorewards/api-docs/wiki/Social-Media-‐-Create-Social-Media-Call-to-Action Make a POST request to the /call-to-actions endpoint to create a social media CTA. Include the action_id and points in the request body. Ensure you have the correct Authorization and X-Application-Key headers. ```bash curl -X POST "https://api.kangaroorewards.com/call-to-actions" \ -H "Authorization: Bearer " \ -H "X-Application-Key: " \ -H "Accept: application/vnd.kangaroorewards.api.v1+json;" \ -H "Content-Type: application/json" \ -d '{ "action_id": 4, "points": 10 }' ``` -------------------------------- ### Create Customer Consent Source: https://github.com/kangaroorewards/api-docs/wiki/Customers-‐-Customer-Consent Send a POST request to the /customers/{customer_id}/consents endpoint to create customer consent. Ensure to include the necessary customer information and authentication headers. ```bash curl -X POST "https://api.kangaroorewards.com/customers/{customer_id}/consents" \ -H "Authorization: Bearer $ACCESS_KEY" \ -H "X-Application-Key: $APPLICATION_KEY" \ -H "Accept: application/vnd.kangaroorewards.api.v1+json;" \ -H "Content-Type: application/json" \ -d '{ "allow_sms": false, "allow_email": true, "allow_push": true }' ``` -------------------------------- ### List All Main Actions Source: https://github.com/kangaroorewards/api-docs/wiki/Workflows-‐-Getting-started Retrieve a list of all available main actions that can be performed within workflows. ```APIDOC ## List All Main Actions ### Description Once you have your access token, you can use it to list all main actions. ### Method GET ### Endpoint https://api.kangaroorewards.com/workflow-main-actions ### Parameters #### Query Parameters - **include** (string) - Optional - Specifies related resources to include in the response (e.g., "triggers,actions"). #### Headers - **Authorization** (string) - Required - Bearer token for authentication (e.g., "Bearer "). - **X-Application-Key** (string) - Required - Your application's key. - **Accept** (string) - Required - Specifies the desired response format (e.g., "application/vnd.kangaroorewards.api.v1+json;"). - **Content-Type** (string) - Required - Specifies the request body format (e.g., "application/json"). ### Request Example ```bash curl -X GET https://api.kangaroorewards.com/workflow-main-actions \ -H "Authorization: Bearer " \ -H "X-Application-Key: " \ -H "Accept: application/vnd.kangaroorewards.api.v1+json;" \ -H "Content-Type: application/json" ``` ### Response #### Success Response (200) - **data** (array) - An array of main actions. - **id** (integer) - The unique identifier for the action. - **action_name** (string) - The name of the action. ``` -------------------------------- ### Delay Type Action Example Source: https://github.com/kangaroorewards/api-docs/wiki/Workflows-‐-How-to-create This JSON structure defines a delay action within a workflow. It specifies a wait time of 86400 seconds (24 hours) and indicates its dependency on a previous action. ```json { "actions": [ { "main_action_id": 4, "temp_parent_id": 1, "temp_id": 2, "relations": [ { "entity_type": "Wait", "value": 86400 // seconds } ] } ] } ```