Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Govinda Khatiwada
@govindak

function my_voicewp_post_types( $post_types ) {
return array( 'special','post','drink' );

}
add_filter( 'voicewp_post_types', 'my_voicewp_post_types' );

Govinda Khatiwada
@govindak
@tomharrigan can you post example of pulling custom post type for /wp-json/voicewp/v1/skill/news its not showing anything pls
Tom Harrigan
@tomharrigan
sure, i'll take a look as soon as i get a chance, sorry for the delay
msaltzm1
@msaltzm1
@tomharrigan , I have a Question about the fact/quote skill area. I wanted to put some playable audio files in some of the random facts. However, I discovered that the form strips out the audio tag when I 'Update' the skill. Any thoughts on how this could be possible?
Tom Harrigan
@tomharrigan
ah, fantastic, yea i'll try to look this weekend (along with looking into Govinda's request above). I think the sanitization filter is just stripping out all markup, I should be able to switch that up so it respects valid ssml tags
V2 of VoiceWP should be coming out in about 2 weeks, it'll have support for the Echo Show, and a new skill type for creating podcast skills
Govinda Khatiwada
@govindak
okay great thank you :)
David Gross
@mimetic

Finally, I'm looking into creating a new skill in VoiceWP, and I'm sorry, but the current instructions are not complete enough for me.

  • It seems I don't need to register an endpoint, since class-voicewp.php appears to do it.
  • The request trickles down to skill_dispatch, which executes:
    do_action( 'voicewp_custom_skill', $skill_type, $id, $request, $response );
  • "do_action" is a WordPress call to execute all functions attached to the action hook, "voicewp_custom_skill".

That's where I'm lost...what do I do next? Clearly, I should create a function (where?). And, I should add my function to the voicewp_custom_skill hook (how, exactly?). I think it would look like this:
add_action( 'voicewp_custom_skill', 'my_function_name_here' );

That's as far as I could figure out tonight. Any help welcome!

Tom Harrigan
@tomharrigan
add_action( 'voicewp_custom_skill', 'my_function_name_here', 10, 4 );

function my_function_name_here( $skill_type, $id, $request, $response ) {
    // Take a look at alexa/skill/news.php
    // the news_request() function shows the logic for getting the intent,
    // and then performing the appropriate actions, and returning a response
}
Tom Harrigan
@tomharrigan
@mimetic you can start with just an echo statement to make sure it's properly outputting content. My recommendation if you're creating a custom skill from scratch is to still use a custom endpoint rather than utilizing this hook because it will be slightly more performant, there's a bit less internal routing logic that would have to run.
David Gross
@mimetic

So, I did something slightly different to try for flexibility. My skill is "explore" (for now).

  • added an "explore" option in voicewp_fm_alexa_app_settings, as a Skill Type
  • duplicated the "news" class (in alexa/skill), and renamed it Explore, as a basis for a new skill.
  • modifed skill_dispatch to use the Skill Class value to load the class, e.g. the Explore class

This approach lets me create a new "Skill" post with WordPress, set the Skill Type to "explore", and it will use the explore class. The idea is to be able to keep the existing skills built into voiceWP, and to most easily extend it with minimal changes to the base VoiceWP code. And, I can call the same website and access multiple "skills", which is very useful.

So, to extend in this case:

  • Add new class name as a "Skill Type" for user to choose
  • Add a new class as a file, e.g. myclass.php, in the alexa/skill folder
  • The skill endpoint is the post ID number of the skill, e.g. ...skill/651

What next:

  • Skill settings should move from settings to appear the skill post (depending on the Skill Type)
  • Read the list of skills in the alexa/skill folder, and make that the basis for the "Skill Type" menu, so you just have to drop your skill class into the folder...and you're done!

Happy to share the work, of course!

David Gross
@mimetic
I get confused by pull requests, sorry. Struggle with Github sometimes...
draffenberg
@draffenberg
I was able to use WPVoice to create flash briefing. How do I control which post is selected by the plugin? I've done some testing and it appears the most recent "post_date" is the flash briefing returned. How do I modify code to go after most recent modified date.
msaltzm1
@msaltzm1
@tomharrigan Looking forward to V2!! Any word yet on an est date of release? :smile:
Tom Harrigan
@tomharrigan
about a week @msaltzm1
is your speakeasy skill still in dev?
msaltzm1
@msaltzm1
@tomharrigan Yes, I had to put that project on the back burner. I had a few other items come up that I believe voicewp would be awesome for
Tom Harrigan
@tomharrigan
@msaltzm1 Cool, would love to hear about them, DM me :)
David Gross
@mimetic
@tomharrigan I could send you my work so far, if that's useful.
Tom Harrigan
@tomharrigan
this? mimetic/voicewp@bd1b9fb
David Gross
@mimetic
This one, the develop branch. I'm in the middle of stuff...but it mostly works.
https://github.com/mimetic/voicewp/tree/develop
I've tried to keep changes to the "explore" skill, but I did have to tweak some of your code.
Tom Harrigan
@tomharrigan
cool, i'll take a look thanks :) Adding support for directives is something i'd like to get added into the core plugin very shortly, to open up support for the AudioPlayer and Display directives
David Gross
@mimetic
Not as elegant as your work, I'm sure. Basically, I'm adding dialoging directives, so I can have 1-work answers, and making the skills more modular. I want articles with links to other articles.
I've used a plugin called "Related Posts for WordPress" to link to other posts, and I haven't abstracted that functionality from my code, so it's hard-wired. That's not a good idea, of course, but I'm developing. What it does is let the user choose posts which are related to the current post; I manage to get the ID of those related posts. I use the "Excerpt" field for a one-word tag, so Alexa can ask, "Would you like to hear more about {linked-post-excerpt} or {linked-post-excerpt} or {linked-post-excerpt}?". User replies with the single word, e.g. "politics", and Alexa plays that linked post.
It's a little clumsy right now, but you get the idea.
In essence, we are navigating a database of linked records, which is pretty cool.
Tom Harrigan
@tomharrigan
nice! yea definitely
i like it :)
David Gross
@mimetic
@tomharrigan Sent you an email with credentials, etc.
Tom Harrigan
@tomharrigan
@mimetic thanks, for the skill beta invite, can you send that to the gmail i DM'd you?
David Gross
@mimetic
Hmmm...to the gmail that popped up in my mail.
Must be the same.
sturtus
@sturtus
Good afternoon! I'd like to create a custom skill, but would prefer to extend the functionality of your plugin with a plugin that runs beside it to avoid modifying your code. Helps for updating the plugin down the road without losing my customizations. Do you have a custom skill "child" plugin or otherwise a custom skill plugin dependent upon the original VoiceWP plugin?
Basically want to build a custom skill using your plugin's available functions, but follow best practices: https://iandunn.name/2014/01/10/the-right-way-to-customize-a-wordpress-plugin/
And is there info on a v2?
Tom Harrigan
@tomharrigan
@sturtus hey, there's an example in the readme on creating custom skills without modifying the plugin https://github.com/alleyinteractive/voicewp#creating-your-own-custom-skills
sturtus
@sturtus
Thanks for the response! I will look into a custom hook in a custom plugin that declares your plugin as a dependency just to make sure somebody doesn't try to activate it without first having VoiceWP activated. Sounds like best practice.
msaltzm1
@msaltzm1
@tomharrigan hello! any news on v2?
lukasj98
@lukasj98
will v2 support german skills
David Gross
@mimetic
@sturtus My version of VoiceWP lets you add your plugin as, well, a plugin. I had to make a few mods to the code. I'm on vacation, back in a few days, and my fork on github isn't up to date. However, it might be good enough for you.
https://github.com/mimetic/voicewp
Look in the alexa/skill folder. I made a "plugin" called "explore". I modifed the original code minimally, just enough to allow the "explore" skill to work.
(Just checked, it's a month or so out of date...but it should work. I'll update in a few days when I get home.)
(Use the "develop" branch").
(Cool if we could do this right...my solution is a real kludge.)
msaltzm1
@msaltzm1
@tomharrigan hello! I was wondering if v2 was still in the pipeline?
Tom Harrigan
@tomharrigan
howdy, been a bit delayed as you can tell, but i'm pretty close to shipping the Echo Show display support, and updated intent schema
there a certain feature or functionality you're looking for sooner rather than later?
cc @msaltzm1
msaltzm1
@msaltzm1
@tomharrigan Not necessarily. I have a couple projects on the backburner as well and I was curious on v2's status. I plan on using voicewp for these 'backburner projects' !!
Tom Harrigan
@tomharrigan
cool
David Gross
@mimetic
@msaltzm1 Hey, did you take a look at my updates to Tom's code? Is it useful to you?
lukasj98
@lukasj98
what about german skill support??