You are here

public function TwilioController::messageIncoming in Twilio 8

Invokes twilio_message_incoming hook.

Parameters

string $number: The sender's mobile number.

string $number_twilio: The twilio recipient number.

string $message: The content of the text message.

array $media: The absolute media url for a media file attatched to the message.

array $options: Options array.

1 call to TwilioController::messageIncoming()
TwilioController::receiveMessage in src/Controller/TwilioController.php
Handle incoming SMS message requests.

File

src/Controller/TwilioController.php, line 79

Class

TwilioController
Default controller for the twilio module.

Namespace

Drupal\twilio\Controller

Code

public function messageIncoming($number, $number_twilio, $message, array $media = array(), array $options = array()) {

  // Build our SMS array to be used by our hook and rules event.
  $sms = array(
    'number' => $number,
    'number_twilio' => $number_twilio,
    'message' => $message,
    'media' => $media,
  );

  // Invoke a hook for the incoming message so other modules can do things.
  $this
    ->moduleHandler()
    ->invokeAll('twilio_message_incoming', [
    $sms,
    $options,
  ]);
  if ($this
    ->moduleHandler()
    ->moduleExists('rules')) {
    rules_invoke_event('twilio_message_incoming', $sms);
  }
}