create integration on the pandium integration hub.md

Create Integration on the Pandium Integration Hub

Now you will create Pandium's record of the integration which will eventually be used to run your code. You'll also let Pandium generate the initial files for your new integration!

  1. Use the command line to create a new branch on a remote repository where Pandium can put the starter files it will generate for your Pokémon integration:
    • This branch must be made on a repository which your source control tenant is authorized to access.
    • For example, run git checkout -b pokemon-integration.
    • Publish the new branch to the online repository (assuming the remote repository is named origin). Run git push -u origin pokemon-integration.
  2. Log into your sandbox Pandium Integration Hub.
  1. From the sidebar menu choose Integrations. This will display the main Integrations page.
  1. In the upper right corner click Create. This will display the New Integration dialog box.
  1. Choose Internal because your Pokémon integration will run on Pandium.
    • You can read more about the different kinds of integrations here.
  2. Click Create. This will display the Configure tab for the New Integration page.
  1. Under Connectors click the dropdown menu to open it.
  2. Select Slack (OAuth2) from the list of Connectors.
    • Do not check the box for Global because this is not a Global connector (you can read more about the different kinds of connectors and their purposes here).
    • You do not need to add a connector for the PokéAPI because you'll be able to fetch information from it without providing any auth.
  3. Under Details enter an Integration ID and Integration Name.

In this example the remote repository is at https://github.com/pandium/sample_integrations.git. In step 1 the pokemon-integration branch was added to that repository. The repository path tells Pandium to create a folder called POKEMON_OF_THE_DAY within that repository, and to add the starter files to that folder.

  1. Under Remote Repository Settings, do the following:
    • For Repository Url, enter the url for the online repository where you would like to store this integration's code. This should be the same one on which you just made a branch in step 1.
    • For Repository Tracking Branch, enter the name of the branch on which you will develop this integration (e.g. pokemon-integration).
    • For Repository Path, enter the path for a new folder in which you would like this integration to be made.
  2. Under Sync Schedule, for Default schedule for a new tenant choose Once Per Day since the integration is called Pokémon of the day.
  3. Click Create. This will display the Provision tab.
  1. Enter the Client ID and Client Secret you got when you created the Slack App.
  2. In the dropdown menu for Scope select users:read and chat:write.
  3. Leave User Scope blank.
  4. Click Provision.
  1. Click Show Secret Keys for the Slack (OAuth2) connector. Make note of PAN_SEC_SLACK_OAUTH_ACCESS_TOKEN displayed in the dialog box. You will use this in your .env when you develop the integration locally.
  1. Click Close to exit the connector secret keys dialog box.
  1. Click Done. This will display the integration details page.

The next step requires that your sandbox Integration Hub has its Source control tenant set up. If you haven't already done that, following these instructions.

  1. Click Setup Integration Repo. This will display the dialog box to Add Pandium files to your repo.
  1. For Language, choose Typescript.
  2. Click Setup Repo. This will display the Source Control tab for the Admin Settings page and kick off a run of your source control tenant. That run will generate a some files to jump start the process of writing the code for this integration.
  1. Once that source control run is complete run git pull origin pokemon-integration to fetch the newly created files. They will help you start writing your integration!