Skip to content
DigiCalls Developers
Documentation · SMS automations

DigiCalls Developers / SMS automations

Turn a business event into a message.

Your app decides what happened. DigiCalls applies your enabled rules and sends the selected template when it is due.

Choose a workflow

WorkflowUse it when
Direct sendYour application already controls timing. Call POST /sms/messages.
Business event → ruleSeveral actions share a named business event. Submit it to POST /sms/automations/events.
One-time scheduleYou know the absolute send time. Call POST /sms/automations/schedules.

These work with many business types: service requests, appointment notices, collection/readiness updates or customer follow-up. Your application must supply the real event and eligible recipient; DigiCalls does not infer changes inside a CRM.

Choose automation permissions

OperationRequired permissions
Read rules and runsautomations:read
Create/edit/enable/pause rules; cancel runsautomations:write
Preview an automationautomations:read + sms:templates:read
Submit events or schedule a messageautomations:write + sms:send
Read resulting message text/statussms:read

Owner/admin controls are also available in Messages → Automations. Existing API keys do not receive new permissions automatically.

Create and enable a rule

This rule sends a confirmation when your system submits request.received. It references an immutable published template.

cURL · create a paused rule
curl --fail-with-body --request POST \
  "https://digicalls.com/api/v1/sms/automations/rules" \
  --header "Authorization: Bearer $DIGICALLS_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "name": "Request confirmation",
  "eventName": "request.received",
  "from": "+12025550100",
  "template": {
    "id": "builtin:request_received",
    "version": 1
  },
  "timing": "immediate",
  "offsetMinutes": 0,
  "maxLatenessMinutes": 60
}'

Store the returned data.id as DIGICALLS_RULE_ID. After reviewing readiness, enable it with the current data.revision:

cURL · enable rule
curl --fail-with-body --request POST \
  "https://digicalls.com/api/v1/sms/automations/rules/$DIGICALLS_RULE_ID/enabled" \
  --header "Authorization: Bearer $DIGICALLS_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "enabled": true,
  "expectedRevision": 1
}'
Timing modeMeaning
immediateAs soon as processing allows; offsetMinutes is 0.
after_event0–43200 minutes after DigiCalls receives the event.
relative_to_time-43200 to +43200 minutes relative to the supplied eventTime. For example, -60 means one hour before.

Edits pause a rule and cancel work not yet claimed for dispatch. Re-enabling never replays old events. A stale expectedRevision is rejected; reload the rule before changing it.

Submit the business event

cURL · business event
curl --fail-with-body --request POST \
  "https://digicalls.com/api/v1/sms/automations/events" \
  --header "Authorization: Bearer $DIGICALLS_API_KEY" \
  --header "Idempotency-Key: request-001-event-v1" \
  --header "Content-Type: application/json" \
  --data '{
  "name": "request.received",
  "to": "+12025550101",
  "values": {
    "business_name": "Example Business",
    "reference": "REQUEST-001"
  }
}'

The event name must match an enabled rule exactly. For relative_to_time, add eventTime as a valid ISO timestamp with Z or an explicit UTC offset.

The response contains the event id, duplicate and runs. Read each run: some may be blocked or skipped. If no enabled rule matches, you receive a notice and no SMS. HTTP 202 alone does not mean a message will be sent.

One event has one recipient and can match multiple rules. Keep the same idempotency key and payload on retry; changing the payload with that key returns 409.

Schedule a single message

Prepare a JSON file named schedule.json using this structure. Replace REPLACE_WITH_FUTURE_ISO_TIMESTAMP with a real timestamp 1 minute–90 days ahead, for example in YYYY-MM-DDTHH:mm:ssZ format. Replace the example numbers and values before sending.

schedule.json · replace placeholders
{
  "from": "+12025550100",
  "to": "+12025550101",
  "template": {
    "id": "builtin:request_received",
    "version": 1,
    "values": {
      "business_name": "Example Business",
      "reference": "REQUEST-001"
    }
  },
  "sendAt": "REPLACE_WITH_FUTURE_ISO_TIMESTAMP",
  "maxLatenessMinutes": 60
}
cURL · schedule a template
curl --fail-with-body --request POST \
  "https://digicalls.com/api/v1/sms/automations/schedules" \
  --header "Authorization: Bearer $DIGICALLS_API_KEY" \
  --header "Idempotency-Key: request-001-scheduled-v1" \
  --header "Content-Type: application/json" \
  --data @schedule.json

Store the returned data.id as the run ID. maxLatenessMinutes is 1–1440 (default 60): work that is too late is skipped instead of sending a stale reminder. No monthly quota is reserved in advance.

Track or cancel a run

cURL · run status
curl --fail-with-body \
  "https://digicalls.com/api/v1/sms/automations/runs/$DIGICALLS_RUN_ID" \
  --header "Authorization: Bearer $DIGICALLS_API_KEY"

Public run data includes timing, status, error, template reference, canCancel and, after handoff, messageId and messageStatus. It omits recipient and text; read message content separately with sms:read.

cURL · cancel an eligible run
curl --fail-with-body --request POST \
  "https://digicalls.com/api/v1/sms/automations/runs/$DIGICALLS_RUN_ID/cancel" \
  --header "Authorization: Bearer $DIGICALLS_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{}'

Cancellation works before dispatch claim. It returns 409 when work cannot be recalled, including submitted or uncertain delivery. Revoking an originating API key can block future work; replacing it does not transfer old scheduled jobs to the new key.

Current bounds: 20 rules, 1000 pending runs, 1000 new runs and 1000 new events per business per UTC day, alongside API and SMS limits. The scheduler checks roughly every five seconds; exact delivery time is not guaranteed.

There is no automation-run webhook topic. Read blocked, skipped or canceled pre-send results through the runs API. Once a message exists, normal SMS status Webhooks apply.