Credits System For Sub-Accounts

 API Endpoint: https://app.mysms.app/api/update-credits-webhook.php

Method: POST

JSON Payload: 
{
    "apiKey": "YOUR_API_KEY_HERE",
    "sub_account_id": "SUB_ACCOUNT_ID_HERE",
    "credit_action": "add",
    "credits": 100
}

Explanation of JSON above:
The apiKey is your MySMS.app API key that you can find at https://app.mysms.app/profile.php Click on the blue button that says "Show/Hide Api Key".

The sub_account_id is exactly what it says, your CRM's unique identifier for that location/sub-account.

The credit_action supports "add", "subtract" or "set". We will automatically handle the subtract function when messages are sent, and it's unlikely you'll ever need to use anything other than "add", but I wanted to support all use cases, so they're the 3 options. If you don't pass a "credit_action" value, we assume "set", so make sure you always pass "add" as the credit_action.

The "credits" is the number of credits you want to adjust the sub-account balance by. Or if you use "set" as the "credit_action" then your "credits" value will be that sub-accounts new balance.

Example API Call:
Add 1000 credits:

POST to https://app.mysms.app/api/update-credits-webhook.php

JSON Payload
{
    "apiKey": "YOUR_API_KEY_HERE",
    "sub_account_id": "SUB_ACCOUNT_ID_HERE",
    "credit_action": "add",
    "credits": 1000
}