Skip to main content

Regulated SMS API: Templates, Messages and Delivery Events

Review Blackleaf API templates, SMS and MMS sends, message status events, recipient requirements and account setup for your integration.

Connect your application to Blackleaf messaging with a REST API for text templates, SMS and MMS sends, message records, and webhook events. The public API reference documents the available operations. Start with your message purpose, recipient requirements and account access before building the integration. If you want a compatible AI app to inspect a workspace or prepare an inactive campaign draft, see how to connect it through MCP. Before creating a draft, use get_workspace to confirm the connected workspace, brand and saved audience. If the workspace is different from the one you intended, use a connection authorized for the correct workspace.

Plan the Message and Data Handoff

An order-ready alert, a receipt notification and a marketing offer have different purposes. Choose the event your application will use, the information the message needs, and the person responsible for replies. An order entering your system is different from an order being ready for pickup.

  • Identify the source record and the event that should start the workflow.
  • Decide which customer and store fields the message actually needs.
  • Define when to stop a message after a cancellation, correction or permission change.
  • Keep message records linked to the originating workflow so staff can investigate an unexpected result.

For dispensaries, Blackleaf Texting is available with supported existing POS systems without a POS switch. Confirm the connection, available fields and update behavior for your setup. API access alone does not establish that every POS event or integration is available.

Review Templates, Messages and Events

The current reference includes creating a text template, checking its acceptance fields, sending SMS or MMS, looking up messages, and reading sender profiles. Use the Blackleaf API developer guide for the implementation walkthrough, then check the current reference for the operation you plan to use. Use the sender profile walkthrough to find the workspace profile ID. Before sending, confirm the profile has an active number and supports the format and route you plan to use. The profile listing identifies a configured sender. Confirm any required registration approval separately for the number, route and intended use.

For a machine-readable reference, open the OpenAPI specification (JSON). It describes the published methods, paths, request fields and response schemas. Use it alongside the developer guide, and confirm any schema or example mismatch before implementation. If you need product or order data, check the API endpoint map to see what the legacy entries read before choosing a data source.

For application signup and password-reset verification, use the dedicated /messaging/send/2fa and /messaging/verify/2fa operations. This flow does not require creating a text template. For issuance, check for success: true and save the returned sessionId with the intended attempt. Before granting access, require verified: true and check that the returned sessionId matches the issuance session. Either operation can return HTTP 200 with a failure in the body. See the application 2FA guide for replacement codes and request routing. It is separate from signing into Blackleaf’s dashboard and from the recipient consent, age and birthday checks below. The sandbox 2FA walkthrough explains how to rehearse issuance and verification without receiving an SMS on a handset.

An initial API response is separate from delivery. For a standalone production send, save the returned data.messageId and match it to hash when that field appears in the production message list. Keep the saved record’s _id separately. For a simulated SMS or MMS send, match the response’s data.messageId to the item’s _id in GET /messaging/messages on the sandbox host for the same workspace. If a timeout leaves you without an identifier, follow the steps for checking an uncertain send before retrying. A delivered status does not prove that the recipient read the message or made a purchase.

Review the workspace and campaign webhook contracts for message status, inbound replies and subscription changes. Review the payload for each event your integration uses. Use the webhook receiver field map to compare field names, identifiers and timestamp formats for workspace and campaign callbacks. Use the webhook recovery checklist to plan for duplicates, receiver failures and missing updates. For workspace callbacks, use the workspace callback verification guide to review the authentication configured for that receiver.

Test the Messaging Flow in the Sandbox

Blackleaf’s messaging sandbox supports template creation, SMS/MMS preparation and the application 2FA send/verify workflow. Use api-sandbox.blackleaf.io or api-dev.blackleaf.io with normal workspace Bearer authentication from your backend. Both hosts share sandbox messages and templates within that workspace. The base URL selects the messaging environment; a request flag does not turn a production send into a simulation.

Simulated SMS/MMS delivery sends no text to a handset and has no delivery fee. For sandbox template and SMS/MMS requests, simulateAi defaults to false, with no AI work or AI charge. Selecting true can run real AI validation when needed and bill its normal cost. The 2FA workflow performs no AI validation. Sandbox templates remain separate from production templates.

Sandbox requests can save test records, update supplied contact data and make real HTTP callbacks to configured receivers. Use fictional data and a test receiver. If your receiver handles both environments, use the environment value sandbox and the simulated value true on simulated delivery status callbacks to keep test events out of production workflows. Follow the messaging API sandbox walkthrough for the request sequence, result checks and production review. Simulated delivery does not establish real carrier delivery, sender readiness or provider approval, and the messaging sandbox is not an isolated copy of every API resource.

Choose an Implementation Walkthrough

Start with the part of the integration you are building. These focused guides explain the workflow and its limits; check the current operation reference for the request you plan to use.

  • Direct SMS and MMS requests. The template-based send walkthrough covers template acceptance, request preparation, response checks and uncertain send outcomes. API acceptance is separate from message delivery.
  • Message images and linked pages. The MMS API walkthrough separates message attachments from landing content and explains what remains to verify beyond a sandbox result.
  • Customer profiles and opt-outs. The contact synchronization guide covers matching identity, confirming the saved result and preserving current subscription choices.
  • Campaign audiences. The campaign audience API guide explains adding or excluding existing contacts on an editable draft and checking the queued action’s saved result. Audience preparation is separate from campaign launch. For POST /list, you can supply an optional requestId UUID and reuse it when retrying the same list creation with unchanged settings. A queued campaign action returns its own requestId and statusUrl. Use those to check the action result before submitting another write. Removing someone from a draft does not unsubscribe them. If a recipient withdraws permission, keep affected sends on hold and verify the saved opt-out separately.
  • Check saved list counts. Use GET /list to find the list ID and see its stored eligible-phone count. Use GET /list/{listId} to calculate current membership and distinct eligible saved phone values. Verify current consent and review the draft audience separately. Saved-list additions and exclusions can overlap, and list matches can change before launch. Use the campaign audience rules to check the reconciled draft before launch.
  • Read reporting data. Use GET /analytics/reports for stored report groups. The reporting API guide shows how to choose a fixed date window and read workspace totals or one location. Keep the same scope, filters and sort as you page through results. Report values can change between requests. A successful response can contain an empty items array. Confirm the location or workspace scope, period, reporting frame and entity filters before reporting zero activity.
  • Inbound replies and staff ownership. The API reply-handoff walkthrough connects callback and conversation context to a staffed reply workflow. Receiving an event is separate from resolving the customer’s request.

Confirm Recipient Requirements and API Access

Blackleaf requires explicit recipient consent and age confirmation before texting. In the message flow, the intended recipient verifies themselves by selecting the birthday on file. Never reveal the saved birthday. Template acceptance and API access do not replace these recipient checks or approval for the intended message and provider route. A contact lookup can return unsubscribed: false when no opt-out value is saved. Verify current permission in your consent records before using that contact in a send. See the dispensary opt-in and consent guide for planning the permission record.

Download the API integration review brief (CSV) to record your message purpose, source event, recipient requirements, reply owner and open setup questions. It is a blank planning aid for discussion, not an API request or launch approval. Keep credentials and customer data out of the file.

For an API setup review, bring your message purpose, source event, recipient rules, expected volume and reply owner. Confirm account access, the available test environment and the activation steps for that use case before scheduling a launch. Contact Blackleaf to review API setup.