I am implementing text to speech calls with laravel and Nexmo. In the application, i am able to place calls to my clients with `English language' as below. The text placed to my customers is
To add a reply, please leave a message after the beep, then press the pound key
Is there a way to convert the text from english to my native language ? So the call will be in the language i converted to ?
Please help? Beginner with this
$currentHost = 'http://abc123.ngrok.io';
Nexmo::calls()->create([
'to' => [[
'type' => 'phone',
'number' => $cc->user->phone_number
]],
'from' => [
'type' => 'phone',
'number' => config('services.nexmo.sms_from')
],
'answer_url' => [$currentHost.'/webhook/answer/'.$entry->id],
'event_url' => [$currentHost.'/webhook/event']
]);
return response()->json([
[
'action' => 'talk',
'text' => $ticket->content
],
[
'action' => 'talk',
'text' => 'To add a reply, please leave a message after the beep, then press the pound key',
'voiceName' => 'Brian'
],
[
'action' => 'record',
'endOnKey' => '#',
'beepStart' => true
]
]);
Related
we are using the following code in order to add a room (Resource) to the location in Outlook calendar event:
$response = [
'Subject' => $subject,
'Body' => [
'ContentType' => 'HTML',
'Content' => 'This is event generated by Clebex!'
],
'Start' => [
'DateTime' => $declaration->datetime_from,
'TimeZone' => 'UTC'
],
'End' => [
'DateTime' => $declaration->datetime_to,
'TimeZone' => 'UTC'
],
'Attendees' => $attendees,
'Location' => [
[
'displayName' => 'Room 1',
'emailAddress' => 'room1#example.com',
'locationIdentifier' => [
'id' => $organizer,
'type' => 'room'
],
]
],
'isOnlineMeeting' => true,
'onlineMeetingProvider' => $meetingProvider
];
Outlook calendar event is created successfully, but location resource is not recognize as such by Outlook. Instead of that in the location field there is only a string 'Room 1'.
Is there a way to 'force' Outlook to read the information from the location and recognize it as the resource?
Many thanks!
So, after doing more research: solution is to add the room as attendee, with type 'resource' instead of 'required'.
After this, room is placed in Location field and is recognized as the resource in Outlook.
in my app the user can update the info of stripe connected account, however I ONLY want to actullay update the value of the fields that appear in the request payload, I could do this with a simple if check but the way I update the stripe array method makes this issue more complicated .
Is there any syntax sugar or trick to make this easier.
How my update method looks;
public function editConnectedAccount(Request $request)
{
$account = Account::retrieve($request->connectedAccountId);
Account::update(
$request->connectedAccountId,
[
'type' => 'custom',
'country' => 'ES',
'email' => $request->userEmail,
'business_type' => 'individual',
'tos_acceptance' => [ 'date' => Carbon::now()->timestamp, 'ip' => '83.46.154.71' ],
'individual' =>
[
'dob' => [ 'day' => $request->userDOBday, 'month' => $request->userDOBmonth, 'year' => $request->userDOByear ],
'first_name' => $request->userName,
'email' => $request->userEmail,
'phone' => $request->userPhone,
'last_name' => $request->userSurname,
//'ssn_last_4' => 7871,
'address' => [ 'city' => $request->userBusinessCity, 'line1' => $request->userBusinessAddress, 'postal_code' => $request->userBusinessZipCode, 'state' => $request->userBusinessCity ]
],
'business_profile' =>
[
'mcc' => 5812, //got it
'description' => '',
//'url' => 'https://www.youtube.com/?hl=es&gl=ES', //got it
],
'capabilities' => [
'card_payments' => ['requested' => true],
'transfers' => ['requested' => true],
],
]
);
return response()->json([
'account' => $account,
], 200);
Consider using a Form Request where you preform validation. This will neaten up your controller for a start and also make validation (never trust user input!) reusable.
Assuming validation is successful, calling $request->validated() from inside your controller method will return only the fields present and validated. You can then use either fill($request->validated()) or update($request->validated()).
I am struggling with the usage of the NotificationPusher component and the possibility to send custom parameters within the payload to apple products.
I've tried the following, since I've found this annotation within the docs on github.
$message = new Message("Hello there", [
'message' => [
'sound' => 'default'
],
'custom' => [
'lat' => 123,
'lon' => 321,
'radius' => 32,
'date' => date('Y-m-d H:i:s'),
'action' => 'update'
]
]);
This syntax sadly didn't led to the expected result. The apple devices wouldn't receive these parameters.
I've also tried this, but this also failed.
$message = new Message("Hello there", [
'message' => [
'sound' => 'default',
'custom_lat' => 123,
'custom_lon' => 321,
'custom_radius' => 32,
'custom_date' => date('Y-m-d H:i:s'),
'custom_action' => 'update'
]
]);
What is the exact syntax so send custom parameters within the payload to apple devices with a push message?
I've dug trough the source code on github and have found out, that the 'custom' key of the array wasn't extracted by the ASPN Adapter.
But I've found a piece of code that extracted the complete 'message' array, so my guess was to add the 'custom' array within the 'message' part, what then also was the solution for my problem.
$message = new Message("Hello there", [
'message' => [
'sound' => 'default',
'custom' => [
'lat' => 123,
'lon' => 321,
'radius' => 32,
'date' => date('Y-m-d H:i:s'),
'action' => 'update'
]
]
]);
I faced the same need. Started debugging and found that KhorneHoly is right: You need to send the payload under custom key. The array format is a little bit different, though:
$message = new Message('This is the message', [
'custom'=> [
'payloadKey' => 'payloadContent'
]
]);
I'm using "sly/notification-pusher": "^2.3"
Hope it helps =)
I have a Tabs widget:
echo Tabs::widget([
'items' => [
[
'label' => 'Add Staff',
'icon' => 'user',
'content' => "Add Staff page loaded here",
'active' => true
],
[
'label' => 'Store Configuration',
'content' => 'Store Configuration page loaded here',
//'headerOptions' => [...],
'options' => ['id' => 'myveryownID'],
],
[
'label' => 'Transaction',
'items' => [
[
'label' => 'Add Transaction',
'content' => 'Add Transaction page loaded here',
],
[
'label' => 'View Transaction',
'content' => 'View Transaction page loaded here',
],
],
],
],
]);
How do I render a page (without reloading the entire page, if possible) inside a Tab content? Is it possible? I tried this:
'content' => "<?= $this->render('createbizstaff', ['searchModel' => $searchModel,'dataProvider' => $dataProvider,]); =>"
But it only generates this error:
Getting unknown property: yii\web\View::render
If you have any idea how to deal with this, please let me know.
You are trying to pass a PHP expression where a string is required. yii\web\View::render() returns a string so your code should read:
'content' => $this->render('createbizstaff', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]),
try using Pjax widget. you can load a part of that content without reloading the whole page. but it will reload the whole page when it reach its timeout and it is still loading.
check this guy's tutorial. http://blog.neattutorials.com/yii2-pjax-tutorial/
I have been trying to get familiar with octobercms, but I've come across an issue I can't seem to resolve. I have a backend controller setup with views etc. Everything works, except that the sidebar isn't loading. Also the tab isn't getting the active state.
http://gyazo.com/25e019c1db34d5807c05ebb4b3277ac7
It should look something like this:
http://gyazo.com/c71a1e1dec7c1e6b81136b313b32da47
Here is a gist with my code: https://gist.github.com/muuknl/fedb8434219c7dbe5d04
If I forgot to give certain information, please let me know and thanks in advance for the help.
here is simple solution
in controller you need to write
BackendMenu::setContext('Archetypics.Team', 'website', 'team');
refer this https://octobercms.com/docs/backend/controllers-views-ajax#navigation-context
BackendMenu::setContext('Author.Plugin name', 'Menu code', 'Sub menu code');
you need to write same thing what you have written in plugin.php in registerNavigation() function
public function registerNavigation()
{
return [
// menu code
'website' => [
'label' => 'Website',
'url' => Backend::url('muukrls/archetypics/team'),
'icon' => 'icon-pencil',
'permissions' => ['archetypics.*'],
'order' => 500,
'sideMenu' => [
'home' => [
'label' => 'Homepage',
'icon' => 'icon-copy',
'url' => Backend::url('muukrls/archetypics/home'),
'permissions' => ['archetypics.home_access'],
],
'about' => [
'label' => 'About Page',
'icon' => 'icon-list-ul',
'url' => Backend::url('muukrls/archetypics/about'),
'permissions' => ['archetypics.about_access'],
],
// sub menu code
'team' => [
'label' => 'Team Members',
'icon' => 'icon-users',
'url' => Backend::url('muukrls/archetypics/team'),
'permissions' => ['archetypics.team_access']
]
]
]
];
}