- Added comprehensive AI Assistant system (aiassist/ directory): * Vector search and embedding capabilities * Typebot proxy integration * Elastic search functionality * Message classification and chat history * MCP proxy for external integrations - Implemented Court Status API (GetCourtStatus.php): * Real-time court document status checking * Integration with external court systems * Comprehensive error handling and logging - Enhanced S3 integration: * Improved file backup system with metadata * Batch processing capabilities * Enhanced error logging and recovery * Copy operations with URL fixing - Added Telegram contact creation API - Improved error logging across all modules - Enhanced callback system for AI responses - Extensive backup file storage with timestamps - Updated documentation and README files - File storage improvements: * Thousands of backup files with proper metadata * Fix operations for broken file references * Project-specific backup and recovery systems * Comprehensive file integrity checking Total: 26,461+ files added/modified including AWS SDK, vendor dependencies, and extensive backup system.
80 lines
2.3 KiB
PHP
80 lines
2.3 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: Stefan
|
|
* Date: 25.05.2016
|
|
* Time: 08:29
|
|
*/
|
|
namespace Workflow\CommunicationProvider;
|
|
|
|
use Workflow\VtUtils;
|
|
|
|
class Twilio extends \Workflow\CommunicationPlugin
|
|
{
|
|
protected $usernameLabel = 'Account SID';
|
|
protected $passwordLabel = 'Auth Token';
|
|
|
|
protected $name = 'Twilio';
|
|
|
|
protected $supported = array(
|
|
'sms' => true
|
|
);
|
|
|
|
public function SMS($data) {
|
|
$sid = $this->get('username');
|
|
$token = $this->get('password');
|
|
|
|
if(empty($data['from'])) {
|
|
$data['from'] = $this->get('default_from');
|
|
}
|
|
|
|
if(substr($data['to'], 0, 2) == '00') {
|
|
$data['to'] = '+'.ltrim($data['to'], '0');
|
|
}
|
|
|
|
if(substr($data['from'], 0, 2) == '00') {
|
|
$data['from'] = '+'.ltrim($data['from'], '0');
|
|
}
|
|
|
|
$parameter = array(
|
|
'To' => ($data['to']),
|
|
'From' => ($data['from']),
|
|
'Body' => $data['content']
|
|
);
|
|
|
|
$response = VtUtils::getContentFromUrl('https://api.twilio.com/2010-04-01/Accounts/'.$sid.'/Messages.json', $parameter, 'post', array('successcode' => array(200, 201), 'auth' => array('user' => $sid, 'password' => $token)));
|
|
}
|
|
|
|
public function test() {
|
|
$sid = $this->get('username');
|
|
$token = $this->get('password');
|
|
|
|
$response = VtUtils::getContentFromUrl('https://api.twilio.com/2010-04-01/Accounts/'.$sid.'.json', array(), 'get', array('auth' => array('user' => $sid, 'password' => $token)));
|
|
if(empty($response)) {
|
|
throw new \Exception('Login credentials could not be verified. Please check if you are using Account SID and no single API Key');
|
|
}
|
|
|
|
}
|
|
|
|
public function getConfigFields()
|
|
{
|
|
$return = parent::getConfigFields(); // TODO: Change the autogenerated stub
|
|
$return['default_from'] = array(
|
|
'label' => 'Default Sender',
|
|
'type' => 'text',
|
|
);
|
|
|
|
return $return;
|
|
}
|
|
|
|
// Add Default Sender
|
|
public function getDataFields($method) {
|
|
$return = parent::getDataFields($method);
|
|
$return['from']['placeholder'] = $this->get('default_from');
|
|
return $return;
|
|
}
|
|
|
|
}
|
|
|
|
\Workflow\CommunicationPlugin::register('twilio', '\\Workflow\\CommunicationProvider\\Twilio'); |