Question

I am trying to make Java application that will overwrite some items just after they are created. There is not much information and examples of usage of Podio API, so I got in stuck already on hook creating and verification.

The code:

    APIFactory apiFactory = new APIFactory(resourceFactory);

    AppAPI appAPI = apiFactory.getAppAPI();
    ItemAPI itemAPI = apiFactory.getItemAPI();
    SpaceAPI spaceAPI = apiFactory.getSpaceAPI();
    HookAPI hookAPI = apiFactory.getHookAPI();

    int spaceId = spaceAPI.getSpaceByURL("https://podio.com/company_name/helpdesk").getId();

    for (ApplicationMini app : appAPI.getAppsOnSpace(spaceId)){
        if(app.getConfiguration().getName().equals("Help Desk")){
            System.out.println(app.getConfiguration().getName());
            HookCreate hookCreate = new HookCreate(URL, HookType.ITEM_CREATE);
            Reference ref = new Reference(ReferenceType.APP,app.getId());
            int hookId = hookAPI.create(ref , hookCreate);

            hookAPI.requestVerification(hookId);
            hookAPI.validateVerification(hookId, CODE);
            break;
        }
    }

So my questions are:

What should be URL in HookCreate object? Podio API documentation says "The url of endpoint" and it doesn't explain much to me. It s not really clear to me also how do I get verification code

Était-ce utile?

La solution

There's a guide to Podio webhooks at https://developers.podio.com/examples/webhooks

It's a three step process:

  1. Create the webhook. Either using the Create Hook operation or doing it manually on Podio (go to the app, then it's developer section). The URL you provide is the publicly available URL where your integration is available. Webhook endpoints must be available on the public internet. When developing locally you can use http://progrium.com/localtunnel/ or http://proxylocal.com/ to expose your localhost.
  2. Verify your webhook. As soon as you create your webhook Podio will attempt to verify it by sending a request to the URL you specified when you created your webhook. The request contains the code you need to send back to Podio using the Validate Hook Verification operation. If you need to verify your hook again you can do it manually from the developer section for your app on Podio or by using the Request Hook Verification
  3. Now you URL will receive a request whenever the hook is invoked.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top