Before proceeding, ensure you have obtained a phone number and API key as described in the prerequisites.
Create a Python virtual environment:
Activate the virtual environment:
Install the Pinnacle Python SDK and FastAPI:
This guide uses version rcs>=2.0.4. Requires: Python <4.0, >=3.8
Create an .env file in your project root and add your Pinnacle API key and signing secret:
To receive inbound SMS messages, you need to configure a webhook in the Pinnacle dashboard:
localhost:8000/inbound-sms.env fileOptionally, you can configure custom HTTP headers (e.g. X-API-KEY) to be
sent on every webhook delivery. Add them in the dashboard or via the
headers field on POST /webhooks/attach.
The PINNACLE-SIGNING-SECRET header is reserved.
Create a new Python file (e.g., main.py) and add the following snippet to the right.
The code above creates a FastAPI endpoint that:
/inbound-smsStart the FastAPI server:
Your server will start on http://localhost:8000. If you’re using ngrok for local development, start it in a separate terminal:
Use the ngrok URL (e.g., https://abc123.ngrok.io/inbound-sms) as your webhook endpoint in the Pinnacle dashboard.
Send an SMS to your Pinnacle phone number from any mobile device. You should see the message logged in your server console:
If you’re not receiving any messages, make sure you have a phone number associated with your webhook.
Your webhook should now be successfully receiving inbound SMS messages as well message status updates for outbound messages!
For more detail about processing the message payload received, please view the process method.
Optionally, you can also create the /send-sms/{phone_number} endpoint to send an initial SMS message out.