DEV Community

BridgeXAPI
BridgeXAPI

Posted on

Send SMS from CSV with Python

Working with message data often starts outside your application.

Exports, internal lists or operational data usually exist as CSV files.

This example shows how to take that data and execute SMS delivery directly from Python.


Use case

You already have:

  • phone numbers
  • optional message content
  • structured data in a CSV file

Instead of uploading files into a dashboard, this approach keeps execution inside your system.


Input format

Create a file named:

numbers.csv
Enter fullscreen mode Exit fullscreen mode

Example:

number,message
31612345678,Verification code: 483921
31623456789,BridgeXAPI test message
Enter fullscreen mode Exit fullscreen mode

The message column is optional.


Run

git clone https://github.com/bridgexapi-dev/bridgexapi-direct-api-python-examples
cd bridgexapi-direct-api-python-examples
pip install -r requirements.txt
copy .env.example .env
python send-from-csv/send_from_csv.py
Enter fullscreen mode Exit fullscreen mode

What happens

Each row is processed independently:

  • the number is validated
  • the message is constructed
  • the request is executed
  • the response is captured

Output includes:

  • order_id
  • bx_message_id
  • cost
  • execution status per row

Why this approach

A CSV file is not just input.

It is part of your system state.

By executing directly from it, you get:

  • reproducible runs
  • full control over execution
  • visibility per message
  • no dependency on manual workflows

Extension paths

This pattern can be extended into:

  • notification pipelines
  • verification systems
  • alerting workflows
  • internal tooling

Repository

https://github.com/bridgexapi-dev/bridgexapi-direct-api-python-examples


Run it.

Inspect the output.

Understand how each message behaves.

Top comments (0)