I have created an interactive message button to open up a dialog.
This is the application code to the interaction message end-point.
$httpClient = new GuzzleHttp\Client();
$httpClient->post($interactionRequest->payload->response_url, [
'json' => [
'text' => 'dialog open',
'trigger_id' => $interactionRequest->payload->trigger_id,
'dialog' => [
'callback_id' => 'ryde-46e2b0',
'title' => 'Request a Ride',
'submit_label' => 'Request',
'elements' => [
[
'type' => 'text',
'label' => 'Pickup Location',
'name' => 'loc_origin',
],
[
'type' => 'text',
'label' => 'Dropoff Location',
'name' => 'loc_destination',
],
],
],
],
]);
Request succeed and the message I have defined in the json text attribute is shown in the slack. But the dialog doesn't open.
What is the missing part of my code, to open up a dialog?
This does not work, because you are not using the correct approach for opening a Dialog.
If you want to open a Slack dialog you need to post the dialog definition along with the trigger to this API method: dialog.open.
Related
I tried to send some closure to the livewire component inside a nested array but it produce this error:
Livewire encountered corrupt data when trying to hydrate the [data-table] component. Ensure that the [name, id, data] of the Livewire component wasn't tampered with between requests.**
What I sent to the component :
<livewire:data-table
:model="$modelClass"
:custom="[
[
'label' => 'E-Mail',
'column'=> 'email'
],
]"
:exclude="['password', 'email_verified_at', 'remember_token', 'updated_at']"
:include="[
[
'label' => 'Role',
'column'=> 'role.name',
'format'=> fn($value, $row) => '<strong>'.ucwords($value).'</strong>',
'formatType' => 'html'
],
[
'label' => 'Search Engine',
'links' => [
[
'title' => fn($row) => $row->name.' Google',
'link' => fn($row) => 'https://google.com/search?q='.$row->name,
'type' => 'button',
]
],
],
[
'label' => 'Social Media',
'links' => [
[
'title' => 'Facebook',
'link' => 'https://facebook.com',
'type' => 'link'
],
[
'title' => 'Instagram',
'link' => 'https://instagram.com',
'type' => 'link'
]
]
],
[
'label' => 'Email Provider',
'links' => [
[
'title' => function($row){
if(str_contains($row->email, 'gmail')){
return 'Google';
}elseif(str_contains($row->email, 'yahoo')){
return 'Yahoo';
}else{
return 'Unidentified';
}
},
'class' => 'cursor-pointer',
'onclick' => 'return false',
]
]
]
]"
/>
Then i check in ComponentCheckshumManager class, my array that contains the closure become empty when go through Hashing using json_encode.
Before Hashing :
Data before hashing
After Hashing :
Data after hashing
This error happens only when refreshing the component, is there any correct way to send closure to the livewire component? Please help.
Depends on name. If it's an attribute, then issue is somewhere else, if it's a magic function, then you have a problem. Each time a template modifies original data, you will get corrupt data. Even if it's $user->full_name magic function, it will corrupt original data.
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
]
]);
I'm currently using the drsdres/yii2-wizardwidget and wanted to modify the icon which shows at the top of the wizard (the round tabs). Here is my wizard config variable setup
$wizard_config = [
'id' => 'stepwizard',
'steps' => [
1 => [
'title' => 'Step 1',
'icon' => 'glyphicon glyphicon-user',
'content' => $this->render('details_step0',[
'form' => $form
]),
'buttons' => [
'next' => [
'title' => Yii::t('app','Next'),
],
],
],
...
],
];
Observing the resulting wizard the values set for 'icon' => 'glyphicon glyphicon-user'generate an HTML tag <span class='glyphicon glyphicon-user'></span>
Is there any way I can modify the icon to be an image i have stored in my web/images folder?
thanks for any suggestions
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']
]
]
]
];
}