# Additional SMS Info

The following SMS information is presented primarily for informational purposes. It pertains to use cases or procedures that, while possible, rarely occur.

## Group Messaging Example

Here is an example application that could be used to perform group messaging using the Plum Voice Inbound SMS platform:

**group\_messaging.php**

```php
<?php
header('Content-type: text/xml');
echo("<?xml version=\"1.0\"?>\n");

// The list of people in this group
$group = array('12125550000'=>'Michael', '12125550001'=>'Bob', '12125550002'=>'Lindsay', '12125550003'=>'Jim');

// Make sure the sender is part of this group
if ( isset($_POST['from']) && isset($group[$_POST['from']]) ) {
  echo('<reply>');

  // Reply to everyone except the sender
  foreach ($group as $to=>$contact) {
    if ($to != $_POST['from']) {
      echo("<sms_message to=\"$to\">".htmlspecialchars($_POST['body']).'</sms_message>');
    }
  }
  echo('</reply>');
} 
else { echo('<reply/>'); }
?>
```

From this example, we've created a messaging group consisting of four people. The SMS request POSTs the “from” variable and we can set up our code to exclude the sender from our reply. We can also use the POST variable “body” to forward the message on to everyone else in the group.

The code allows for the following SMS exchange:

> **Michael: Has anyone paid the insurance bill?**\
> \&#xNAN;*(Bob, Lindsay and Jim receive SMS message)*\
> \
> **Bob: When is it due?**\
> \&#xNAN;*(Michael, Lindsay and Jim receive SMS message)*\
> \
> **Michael: Next Monday?**\
> \&#xNAN;*(Bob, Lindsay and Jim receive SMS message)*\
> \
> **Jim: I might have? I'll have to check, Michael.**\
> \&#xNAN;*(Michael, Bob and Lindsay receive SMS message)*\
> \
> **Lindsay: No, he didn't.**\
> \&#xNAN;*(Michael, Bob and Jim receive SMS message)*

## The \<sms\_message> Tag

The \<sms\_message> tag supports a number of optional parameters that can be used to build more advanced SMS applications. These attributes give you the ability to send SMS messages to multiple recipients from any of your SMS numbers as well as setting up callback URLs so that you can be notified when the messages have been sent. Here is the full list of supported attributes:

| Attribute   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| to          | <p>Phone number that the SMS message will be sent to<br><em>Note: You must include a '1' before the 10 digit phone number. If the 'to' attribute is not provided, the default is set to the originating phone number that sent the SMS message.</em></p>                                                                                                                                                                                                                                                                                                           |
| from        | <p>Phone number that the SMS will appear from<br><em>Note: This phone number must appear as an “SMS Number” on the “Account Configuration” page in your Plum DEV account. Any attempt to reply using an SMS using a number not listed as an “SMS Number” in your account will fail. If the 'from' attribute is not provided, the default is set to the SMS number that received the SMS message.</em><br><br><em>Your SMS-enabled number must be non-PCI. SMS is unencrypted, which makes SMS messaging incompatible with PCI numbers and infrastructure.</em></p> |
| result\_url | <p>URL for tracking the SMS result status<br><em>Note: After the SMS is sent, this URL will receive a POST with the following variables: 'sms\_message\_id' and 'status'. This should be used to get the status of an SMS message. If the 'result\_url' attribute is not provided, the default is set to no result URL being used.</em></p>                                                                                                                                                                                                                        |

Here is an example application that sends three SMS messages as a response to an incoming message:

```markup
<?xml version="1.0"?>
<reply>
    <sms_message to="12125550000" from="6177123000">Yeah, mom's awesome. We should call her!</sms_message>
    <sms_message to="12125550001" from="6177123000">There's always money in the banana stand!</sms_message>
    <sms_message to="12125550002" from="6177123000">Return from whence you came!</sms_message>
</reply>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.plumvoice.com/dev/plum-dev-guide/sms-guide/receiving-and-replying-to-sms-messages.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
