You can send messages using the send method provided by the Pinnacle class in the SDK.

Send

send(messsage: Message, phone_number: Optional[str]) -> dict[str, str]

Parameters

message
Message
required

Message object containing the content and type of the message you want to send. See below for the types of messages you can send.

phone_number
string

The phone number of the recipient. It should be in E.164 format (e.g., +14155552671).

If not provided, the message will be sent to the phone number associated with your account. See Get account number for more details.

Returns

response
dict
required

Returns a dictionary containing the status of the sent message. The structure of the dictionary is as follows:

  • message: Message from the server indicating the result of the send operation.

Messages

SMS/MMS Message

To send a standard SMS or MMS message, create a SMSMessage object with the desired content and optional medial url.

SMSMessage(content: str, medialUrl: Optional[str] = None)

Parameters

content
string
required

The text content of the SMS or MMS message.

mediaUrl
string

The URL of the media to be sent with the MMS message.

Usage

send_sms_message.py
from rcs import Pinnacle, SMSMessage

pinn = Pinnacle(
    api_key=YOUR_API_KEY,
    webhook_url=YOUR_WEBHOOK_URL,
)

message = SMSMessage(
    "Hello, this is a test SMS message!",
    image_url  # Optional media URL
)

pinn.send(
    message,
    phone_number,
)

Text RCS Message

To send a RCS text message, create a RCSBasicMessage object with the desired content.

RCSBasicMessage(text: str)

Parameters

text
string
required

The text content of the RCS message.

Usage

send_rcs_message.py
from rcs import Pinnacle, RCSBasicMessage

pinn = Pinnacle(
    api_key=YOUR_API_KEY,
    webhook_url=YOUR_WEBHOOK_URL,
)

message = RCSBasicMessage("Hello, this is a test message!")

pinn.send(
    message,
    phone_number,
)

Media RCS Message

To send a RCS media message, create a RCSMediaMessage object with the desired content.

RCSMediaMessage(media_type: MediaType, media_url: str)

Parameters

media_type
MediaType
required

The type of media being sent. See the MediaType for available options.

media_url
str
required

The URL of the media to be sent.

Usage

send_rcs_message.py
from rcs import Pinnacle, RCSMediaMessage

pinn = Pinnacle(
    api_key=YOUR_API_KEY,
    webhook_url=YOUR_WEBHOOK_URL,
)

message = RCSMediaMessage(
    media_type="file",
    media_url=MEDIA_URL
)

pinn.send(
    message,
    phone_number,
)

Card Message

To send a Card, create a Card object with the desired content.

Card(title: str, subtitle: Optional[str] = None, image_url: Optional[str] = None)

Parameters

title
str
required

The title of the card. Max length is 80 characters.

subtitle
str

The subtitle of the card. Max length is 80 characters.

image_url
str

The URL of the image to be displayed on the card.

Styling

Horizontal card

To create a horizontal card, use the with_horizontal_style method.

with_horizontal_style(
    width: Optional[CardWidth] = None,
    thumbnail_url: Optional[str] = None,
    image_alignment: Optional[CardImageAlignment] = None
)

Parameters

width
CardWidth

The width of the card. See the CardWidth for available options.

thumbnail_url
str

The URL of the thumbnail image to be displayed on the card.

image_alignment
CardImageAlignment

The alignment of the image on the card. See the CardImageAlignment for available options.

Vertical card

To create a vertical card, use the with_vertical_style method.

with_vertical_style(
    width: Optional[CardWidth] = None,
    thumbnail_url: Optional[str] = None,
    media_height: Optional[MediaHeight] = None,
)

Parameters

width
CardWidth

The width of the card. See the CardWidth for available options.

thumbnail_url
str

The URL of the thumbnail image to be displayed on the card.

media_height
MediaHeight

The height of the media on the card. See the MediaHeight for available options.

Buttons

You can also add buttons to your card using the with_buttons method. Max length is 4 buttons.

with_buttons(buttons: List[Action])

Parameters

buttons
List[Action]

A list of Action objects to be included as buttons on the card. See the Action for more details on how to create an action.

Usage

send_rcs_message.py
from rcs import Pinnacle, Card

pinn = Pinnacle(
    api_key=YOUR_API_KEY,
    webhook_url=YOUR_WEBHOOK_URL,
)

message = (
    Card(
        title="Card Title",
        subtitle="Card Description", # Optional
        image_url=card_image_url, # Optional
    )
    .with_horizontal_style(
        width="medium",
        image_alignment="left",
    )
    .with_buttons(
        [
            Action(
                title="URL",
            ).weburl("https://example.com"),
        ]
    )
)

pinn.send(
    message,
    phone_number,
)

To send a Carousel, create a Carousel object with a list of cards.

Carousel(cards: List[Card])

Parameters

cards
cards: List[Card]
required

A list of Card objects to be included in the carousel. Max length is 10 cards.

Usage

send_rcs_message.py
from rcs import Pinnacle, Card

pinn = Pinnacle(
    api_key=YOUR_API_KEY,
    webhook_url=YOUR_WEBHOOK_URL,
)

card = (
    Card(
        title="Card Title",
        subtitle="Card Description", # Optional
        image_url=card_image_url, # Optional
    )
    .with_horizontal_style(
        width="medium",
        image_alignment="left",
    )
    .with_buttons(
        [
            Action(
                title="URL",
            ).weburl("https://example.com"),
        ]
    )
)

message = Carousel(cards=[card, card])  # Add multiple cards

pinn.send(
    message,
    phone_number,
)

Quick Replies

You can optionally attach quick replies to your messages. To do this, use the with_quick_replies method on your message object.

with_quick_replies(quick_replies: List[Action])

Action

Actions are used to create quick replies and buttons. There are two steps to creating a button:

  1. Create an Action object.
  2. Specify what type of action using methods like weburl, postback, etc.

To create an action for quick replies, create an Action with its class and action-specific function.

Create an action

Action(title: str)

Parameters

title
str
required

The title of the action that will be displayed as a quick reply or button. Max length is 25 characters.

Usage

action.py
from rcs import Action

action = Action(title="Quick Reply")

Action Types

Web URL

Open a URL when the action is clicked.

weburl(url: str)
url
str
required

The URL to be opened when the action is clicked.

Call

Call a phone number when the action is clicked.

call(phone_number: str)
phone_number
string
required

The phone number to be called. It should be in E.164 format (e.g., +14155552671).

Postback

Send a postback message when the action is clicked.

postback(payload: str, execute: Optional[str] = None)
payload
string
required

The payload to be sent in the postback message. Max length is 1000 characters.

execute
string

Optional parameter to specify additional data to be executed.

Share Location

Share a location when the action is clicked.

share_location()

Schedule Event

Schedules a calendar event when the action is clicked.

calendar(title: str, start_time: datetime, end_time: datetime, description: Optional[str] = None)
title
string
required

The title of the event.

start_time
datetime
required

The start time of the event.

end_time
datetime
required

The end time of the event.

description
string

Optional description of the event.

Usage

action.py
from datetime import datetime
from rcs import Action

action = Action(title="Schedule Event").calendar(
    title="Meeting",
    start_time=datetime(2023, 1, 1, 10, 0),
    end_time=datetime(2023, 1, 1, 11, 0),
    description="Discuss project updates"
)

Add quick replies

with_quick_replies(quick_replies: List[Action])

Parameters

quick_replies
List[Action]
required

A list of Action objects to be included as quick replies. Max length is 11.

send_rcs_message.py
from rcs import Pinnacle, Card

pinn = Pinnacle(
    api_key=YOUR_API_KEY,
    webhook_url=YOUR_WEBHOOK_URL,
)

message = (
    Card(
        title="Card Title",
        subtitle="Card Description", # Optional
        image_url=card_image_url, # Optional
    )
    .with_buttons(
        [
            Action(
                title="URL",
            ).weburl("https://example.com"),
        ]
    ).with_quick_replies(
        [
            Action(
                title="URL",
            ).weburl("https://example.com"),
            Action(
                title="Call",
            ).call("+14155552671"),
        ]
    )
)

pinn.send(
    message,
    phone_number,
)

Types

MediaType

The MediaType can be one of the following:

  • text
  • image
  • video
  • audio
  • file

CardWidth

The CardWidth can be one of the following:

  • small
  • medium

CardImageAlignment

The CardImageAlignment can be one of the following:

  • left
  • right

MediaHeight

The MediaHeight can be one of the following:

  • small
  • medium
  • tall