(ZAF v1) Building your first Zendesk app - Part 1: Laying the groundwork Follow

Comments

23 comments

  • Avatar
    Toby Scholz

    Hi there,

    am trying to install ZAT, but receive error: Failed to build gem native extension.

    Any idea where I'm going wrong? Permissions for directory are ok and UAC is turned off. This is Win7 Pro, screenshot attached.

  • Avatar
    ShawnW.Cooke

    Hi Toby,

     

    Nice article. Are there any resources for beginners on how to add a settings template to an app? My app requires the user set a few things and I am not sure how to do this. Thanks!

  • Avatar
    Charles Nadeau

    Hi Shawn,

    You can check out this blog post called "How we build apps" from the Zendesk engineering team:  [http://developer.zendesk.com/blog/2013/01/08/how-we-build-apps/](http://developer.zendesk.com/blog/2013/01/08/how-we-build-apps/). It has an example of a form template that takes user input (a search term).

    Charles

  • Avatar
    Gokul

    Hi Charles,

    Do the ZAT tools require to install in all client system too or require to install only on server where my web application run?

  • Avatar
    Charles Nadeau

    Hi Gokul,

    The ZAT tools only have to be installed on the computer you use to build apps. Typically that's your work laptop. The tools don't need to be installed on client computers.

    Charles

  • Avatar
    Sean Kinney

    **@Shawn:** We've recently rolled out another resource if you're looking for an example of how apps behave. You can check out a ton of useful examples in https://github.com/zendesk/demo\_apps while https://github.com/zendesk/demo\_apps/tree/master/settings\_sample\_app explicitly covers using settings in apps.

  • Avatar
    Chirag Shah

    @Charles,

    Can we have a submit button clicking on which it can call a external REST api?

  • Avatar
    Charles Nadeau

    @Chirag,

    Check out the source code for the basic ticket sample app on our page on Github. [https://github.com/zendesk/demo\_apps/tree/master/basic\_ticket\_sample](https://github.com/zendesk/demo_apps/tree/master/basic_ticket_sample).

    You can dig into other sample apps for techniques, reusable code, and inspiration: [https://github.com/zendesk/demo\_apps.](https://github.com/zendesk/demo_apps)

     

  • Avatar
    Jon Lopez

    This might be a silly question, but I'm going to ask it anyway :-)

    I'm trying to get the users external\_id and enter it as a placeholder to get information from our program page's admin page. What would be the best way of doing that?

  • Avatar
    Sean Kinney

    **@Jon:** you can do this using the data API in the app framework. If you want the external ID of the agent currently accessing the agent interface then you'd do something like this:

    var externalID = this.currentUser().externalId()

    That's described in http://developer.zendesk.com/documentation/apps/reference/data.html#current-user-api if you're curious.

    If you instead need the external ID of the requester on a ticket, you'd do:

    var externalID = this.ticket().requester().externalId()

  • Avatar
    Chirag Shah

    Hi

     

    I have a button on Zendesk app.When i click on it i want to redirect it to new page hosted on one of my external sites.How do i do it.

     

  • Avatar
    Sean Kinney

    **@Chirag:** I'd suggest updating your template so that you replace your button with a link that looks like this:

    Open link

    That avoids having to open the link in a new window using Javascript, and the link is styled like a button thanks to the Bootstrap CSS available in the app framework.

  • Avatar
    Amy Lam

    Documentation tweak: can't name folder as xr-app, but xr works. (Maybe no dash allowed?)

  • Avatar
    Charles Nadeau

    Thanks, Amy. I updated the docs. While I was at it, I took the opportunity to completely revise the tutorial. It now uses different, hopefully more relevant APIs and shows a few more JavaScript techniques.

  • Avatar
    Amy Lam

    Hi Charles - Thanks, just revisited the tutorial, very useful Part 4!

  • Avatar
    Sravan Dandra

    I have a requirement to create some custom fields on user, organisation whenever someone installs my app. And app there on uses those custom fields whenever app is initialised. So how can I create custom fields on app creation. Are there any events,triggers I can listen to on app creation?

  • Avatar
    Angelica Coleman

    Hi Sravan,

    It's very easy to create custom fields on app creation by writing it into your 'app.js' file. Part 3 of this tutorial cover the process a bit more in depth:

    App.js defines all the event listeners, requests, and functions that Zendesk needs to run your app. Zendesk apps are event driven. Building an app boils down to telling your app to do certain things when it detects certain events. Events include the application starting up or a user clicking a button.

    By default, the app.js file lists one event listener, 'app.activated':'doSomething', and one function called doSomething. This code tells the app to listen for a framework event named 'app.activated', which fires right after the app is activated. When the event is detected, the app looks up and runs the function named 'doSomething'.

    Since you're looking to create a custom field once the app is created, we would add the event 'app.created', which will fire the first time the app is loaded for the first time. We can then add a function called something like "createCustomField", which will happen when the app detects that 'app.created' happened.

    (function() {

    return {
    events{
    'app.activated':'showInfo',
    'app.created':'createCustomField",
    },

    showInfo: function() {
    },

    createCustomField() {
    },
    };
    }());

    Another option is using your requirements.json file to declare a dependency, if your app depends on the existence of another resource in Zendesk. When an account administrator installs your app, the resource will automatically be created in the account.

    Note: At the moment, we support requiring ticket fields, user fields, triggers, views, automations, and targets.

    That documentation is here: https://developer.zendesk.com/apps/docs/agent/apps_requirements

    Let me know if that helps!

    Angie

  • Avatar
    Sravan Dandra

    Thanks, Angelica. That was really helpful

  • Avatar
    Remo Deplazes

    Hi

    I have followed the instructions above. Ruby and ZAT gem installation were successful. If try to create the app files I get the following errors:

    ruby 2.1.5p273 (2014-11-13 revision 48405) [i386-mingw32]

    c:\Apps>zat new
    C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': ca
    nnot load such file -- ftools (LoadError)
    from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
    `require'
    from C:/Ruby21/lib/ruby/gems/2.1.0/gems/rubyzip-0.9.1/lib/zip/zip.rb:4:i
    n `'
    from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
    `require'
    from C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
    `require'
    from C:/Ruby21/lib/ruby/gems/2.1.0/gems/zendesk_apps_tools-1.22.3/lib/ze
    ndesk_apps_tools/command.rb:2:in `'
    from C:/Ruby21/lib/ruby/gems/2.1.0/gems/zendesk_apps_tools-1.22.3/bin/za
    t:5:in `'
    from C:/Ruby21/bin/zat:23:in `load'
    from C:/Ruby21/bin/zat:23:in `'

    Regards
    Remo

  • Avatar
    Charles Nadeau

    Hi Remo,
    Your Windows system might not have all the tools necessary to build and use native Ruby gems. You can install an add-on called DevKit to get these tools. See http://blog.mattwynne.net/2010/10/12/installing-ruby-gems-with-native-extensions-on-windows/.

  • Avatar
    Maurice

    I can't access Part 2 through 5, just says You're not authorized to access this page

    Any ideas?

  • Avatar
    Charles Nadeau (Edited )

    Hi Maurice, 

    The pages should be accessible now.

    In case you haven't heard, we announced the sunsetting of version 1 of the Apps framework. See https://support.zendesk.com/hc/en-us/articles/115004453028 for more details.

    You can try a similar tutorial series for version 2: https://help.zendesk.com/hc/en-us/articles/229137267-Building-your-first-Zendesk-app-Part-1-Laying-the-groundwork.

    Charles

Please sign in to leave a comment.

Powered by Zendesk