Sample application demonstrating Telnyx.net SMS and MMS attachments
The full documentation and tutorial is available on developers.telnyx.com
You will need to set up:
- Telnyx Account
- Telnyx Phone Number enabled with:
- Ability to receive webhooks (with something like ngrok)
-
- DotNet Core installed
- AWS Account setup with proper profiles and groups with IAM for S3. See the Quickstart for more information.
- Previously created S3 bucket with public permissions available.
- Send an SMS or MMS and recieve a copy of the attachments back to your phone number
- Upload a file to AWS S3
- Send those file as an MMS via Telnyx
The following environmental variables need to be set
Variable | Description |
---|---|
TELNYX_API_KEY |
Your Telnyx API Key |
TELNYX_PUBLIC_KEY |
Your Telnyx Public Key |
TELNYX_APP_PORT |
Defaults to 8000 The port the app will be served |
AWS_PROFILE |
Your AWS profile as set in ~/.aws |
AWS_REGION |
The region of your S3 bucket |
TELNYX_MMS_S3_BUCKET |
The name of the bucket to upload the media attachments |
This app uses the excellent dotenv.net package to manage environment variables.
Make a copy of .env.sample
and save as .env
and update the variables to match your creds.
TELNYX_API_KEY=
TELNYX_PUBLIC_KEY=
TENYX_APP_PORT=8000
AWS_PROFILE=
AWS_REGION=
TELNYX_MMS_S3_BUCKET=
Callback Type | URL |
---|---|
Inbound Message Callback | {ngrok-url}/messaging/inbound |
Outbound Message Status Callback | {ngrok-url}/messaging/outbound |
Run the following commands to get started
$ git clone https://github.com/team-telnyx/demo-dotnet-telnyx.git
This application is served on the port defined in the runtime environment (or in the .env
file). Be sure to launch ngrok for that port
./ngrok http 8000
Terminal should look something like
ngrok by @inconshreveable (Ctrl+C to quit)
Session Status online
Account Little Bobby Tables (Plan: Free)
Version 2.3.35
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://your-url.ngrok.io -> http://localhost:8000
Forwarding https://your-url.ngrok.io -> http://localhost:8000
Connections ttl opn rt1 rt5 p50 p90
0 0 0.00 0.00 0.00 0.00
At this point you can point your application to generated ngrok URL + path (Example: http://{your-url}.ngrok.io/messaging/inbound
).
Open your IDE and run the application