GitHub Bot
- Introduction
- Configure the GitHub service
- Import the package
- Test the integration behaviors
- Next steps
Introduction
This package creates GitHub Bot for demonstrating integration between Cerb and GitHub’s API.
Configure the GitHub service
If you haven’t already, follow these instructions to configure the GitHub service and add your first connected account.
Import the package
Navigate to Setup » Packages » Import.
Paste the following package into the large text box:
{
"package": {
"name": "GitHub",
"cerb_version": "9.1.0",
"revision": 1,
"requires": {
"cerb_version": "9.1.0"
},
"configure": {
"prompts": [
{
"type": "chooser",
"label": "GitHub Account:",
"key": "github_account_id",
"params": {
"context": "cerberusweb.contexts.connected_account",
"single": true,
"query": "name:github"
}
}
]
},
"placeholders": []
},
"bots": [
{
"uid": "bot_1",
"name": "GitHub",
"owner": {
"context": "cerberusweb.contexts.app",
"id": 0
},
"is_disabled": false,
"params": {
"config": null,
"events": {
"mode": "all",
"items": []
},
"actions": {
"mode": "all",
"items": []
}
},
"image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAAAXNSR0IArs4c6QAAFBRJREFUeAHtnQd8VVWawD8eHaSXhB4QCD3UUBQBB6VIV1DQxVXpgjpUHd0d3FUsIwgEFAFlBxwFhuaMMriKinRYJShICxAgQAABKYqU4Hz/oy/7SPLqPXkJyXy/X/Leu/eec79yzzlfu9/J84uCZHO4du2auP9S9HvK9euSkpIi1/UzLfp58uQRl8slefPmlbx85ssn+Tz+sjmpki+7IQiDf/rpJzl9+rSc/l7/zpyWpKQkSUxMlGNHj0ry8WQ5c+aMnDt3Ti5cuCCXL19OFQrCKFiwoBQrVkxKlCghpUuXlsgKkVKpUiWpFhUllStXljKly0iZsmWkbNmyUrhwYaFNdoI82WWEXLx4UXbu3Cm7d+2Wffv2ysGDiZJ48KAkHU2Syz9ftsKzgoUKSuVKlY1watSoLrVrR0t0nWipV6+eEaKVmzjsJEsFcvXqVdm7d6+s/vRT2bRpsxw5ckROJCebJz/tVOSQznTNGRmMpIjISDNyWrVqKR3vukuFVFvy58+f7vpwHc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eBQMBjxDPTjGs4mbEmQ16/VWio6jKkEGDpYm6UTre1dHE7jEaixQtYtYjEIZBWPk4KM+eOatDvIK5LlhiPHHMqu9sYvPipEnG+AwFh5AEwo1iW7aUV159VV566SWz6wzzsjeA4Szg/Bk1V5Mq2GWgkGo6rC2X9R1FhEEiwalTJ2XIkKEm/u6e3rz1m52O8/Cw4wGbvbSIbREyaiELhDs2a95MJj4/UaaohU6okynJH8B4Alq+gOnEl4B9tc2Kc6jRv+v4O40RjXacBRrcBJeGWp4K0ocm6SjBGETNswHhWEds4Ekf0Ny9R3fDA1JynU6zjjkIAqipr+tu0Rh7c2fPMeHRzF6YbTE01H7QnNj/g0DTaHUP2ZpeHQvETRAITVCVuFHDRjJTo3zUEAx3WNSNS2Z/YpMxMzw+cqR0vaer1dtZE4gbq06dOxlP6l/efdekkxK4yklAfKeXWt8DHtSMmeja1kmzLhCmsOg60TJ67Bi5vW1bs6fUWk0TygnQVukZNHiwapixfvfXCpVe6wJxI4J1jt3RslVL3XVhpdHE2H/pZgSqj7JO3NPtHlMXy+nC7YsHmSYQbgrixEX6D+hv1MLZb83WaWy5nDxx0hiC3hDDLvHn6vfWNpDjgbgyWBPJu+3Vq7cMHjLY7PgZSN9Or8lUgXgix9z77HPPmhDm8uXLNSltrSlPizHoqZGh05cpU9psmefZ3uZ3jNFixYubyJ2n7YSgMFira/i67R1tpY9mcdbSxI1ABGgLv3R5WbY69tcPOVxEF7eqx5WswYT9CcK+TszPODBj1eubmUCA6hX1NxmPrzqWa95aU5pqwjlWdus2bfz66jILtywTCAQxMqgihHBOnTql4hATnSRNx1fc2QYzGBlszJKUdMTEZ0jMYDNMNqsM54hIS0uWCiQtMv/6LfJP0ppSPF7qXXIAAAAASUVORK5CYII=",
"behaviors": [
{
"uid": "behavior_4",
"title": "API: GET /user/repos",
"is_disabled": false,
"is_private": true,
"priority": 50,
"event": {
"key": "event.macro.bot",
"label": "Custom behavior on bot"
},
"nodes": [
{
"type": "action",
"title": "Execute HTTP Request",
"status": "live",
"params": {
"actions": [
{
"action": "core.va.action.http_request",
"http_verb": "get",
"http_url": "https://api.github.com/user/repos",
"http_headers": "User-Agent: Cerb",
"http_body": "",
"auth": "connected_account",
"auth_connected_account_id": "{{{github_account_id}}}",
"options": {
"raw_response_body": "1"
},
"run_in_simulator": "1",
"response_placeholder": "_http_response"
},
{
"action": "_set_custom_var",
"value": "{{_http_response.body|json_pretty}}",
"format": "json",
"is_simulator_only": "0",
"var": "response_json"
}
]
}
}
]
},
{
"uid": "behavior_10",
"title": "API: POST /repos/:owner/:repo/issues",
"is_disabled": false,
"is_private": true,
"priority": 50,
"event": {
"key": "event.macro.bot",
"label": "Custom behavior on bot"
},
"variables": {
"var_repository": {
"key": "var_repository",
"label": "repository",
"type": "S",
"is_private": "0",
"params": {
"widget": "single"
}
},
"var_title": {
"key": "var_title",
"label": "title",
"type": "S",
"is_private": "0",
"params": {
"widget": "single"
}
},
"var_body": {
"key": "var_body",
"label": "body",
"type": "S",
"is_private": "0",
"params": {
"widget": "multiple"
}
}
},
"nodes": [
{
"type": "action",
"title": "Call API to create issue",
"status": "live",
"params": {
"actions": [
{
"action": "core.va.action.http_request",
"http_verb": "post",
"http_url": "https://api.github.com/repos/{{var_repository}}/issues",
"http_headers": "User-Agent: Cerb\r\nContent-Type: application/json",
"http_body": "{% set request = {} %}\r\n{% set request = dict_set(request, \"title\", var_title) %}\r\n{% set request = dict_set(request, \"body\", var_body) %}\r\n{{request|json_encode|json_pretty}}\r\n",
"auth": "connected_account",
"auth_connected_account_id": "{{{github_account_id}}}",
"options": {
"raw_response_body": "1"
},
"run_in_simulator": "1",
"response_placeholder": "_http_response"
},
{
"action": "_set_custom_var",
"value": "{{_http_response.body|json_pretty}}",
"format": "json",
"is_simulator_only": "0",
"var": "response_json"
}
]
}
}
]
},
{
"uid": "behavior_8",
"title": "Create GitHub Issue",
"is_disabled": false,
"is_private": true,
"priority": 50,
"event": {
"key": "event.message.chat.worker",
"label": "Conversation with worker"
},
"nodes": [
{
"type": "action",
"title": "Prompt which repo?",
"status": "live",
"params": {
"actions": [
{
"action": "_run_behavior",
"on": "_trigger_va_id",
"behavior_id": "{{{uid.behavior_5}}}",
"run_in_simulator": "1",
"var": "_behavior"
},
{
"action": "send_message",
"message": "Which GitHub repo do you want to create the issue on?",
"format": "",
"delay_ms": "1000"
},
{
"action": "prompt_buttons",
"options": "{{_behavior.repos_with_issues|join('\\n')}}",
"color_from": "#4795f7",
"color_mid": "#4795f7",
"color_to": "#4795f7",
"style": ""
}
]
}
},
{
"type": "action",
"title": "Save repo and confirm",
"status": "live",
"params": {
"actions": [
{
"action": "_set_custom_var",
"value": "{{message}}",
"format": "",
"is_simulator_only": "0",
"var": "prompt_repository"
},
{
"action": "send_message",
"message": "Ok, I will use the repo '{{prompt_repository}}'",
"format": "",
"delay_ms": "1000"
}
]
}
},
{
"type": "action",
"title": "Prompt for issue title?",
"status": "live",
"params": {
"actions": [
{
"action": "send_message",
"message": "Summarize the issue:",
"format": "",
"delay_ms": "1000"
},
{
"action": "prompt_text",
"placeholder": "(e.g. PC Load Letter!? What the frak does that mean?)"
},
{
"action": "_set_custom_var",
"value": "{{message}}",
"format": "",
"is_simulator_only": "0",
"var": "prompt_title"
}
]
}
},
{
"type": "action",
"title": "Save title and confirm",
"status": "live",
"params": {
"actions": [
{
"action": "_set_custom_var",
"value": "{{message}}",
"format": "",
"is_simulator_only": "0",
"var": "prompt_title"
}
]
}
},
{
"type": "action",
"title": "Create the new issue",
"status": "live",
"params": {
"actions": [
{
"action": "_run_behavior",
"on": "_trigger_va_id",
"behavior_id": "{{{uid.behavior_10}}}",
"var_repository": "{{prompt_repository}}",
"var_title": "{{prompt_title}}",
"var_body": "Created via Cerb bot",
"run_in_simulator": "0",
"var": "_behavior"
},
{
"action": "_set_custom_var",
"value": "{{_behavior.response_json|json_encode|json_pretty}}",
"format": "json",
"is_simulator_only": "0",
"var": "response_json"
},
{
"action": "send_message",
"message": "I created issue #{{response_json.number}} for you: {{response_json.html_url}}",
"format": "",
"delay_ms": "1000"
}
]
}
}
]
},
{
"uid": "behavior_2",
"title": "Get Interactions for worker",
"is_disabled": false,
"is_private": false,
"priority": 50,
"event": {
"key": "event.interactions.get.worker",
"label": "Conversation get interactions for worker",
"params": {
"listen_points": "global"
}
},
"nodes": [
{
"type": "switch",
"title": "Point:",
"status": "live",
"nodes": [
{
"type": "outcome",
"title": "global",
"status": "live",
"params": {
"groups": [
{
"any": 0,
"conditions": [
{
"condition": "point",
"oper": "is",
"value": "global"
}
]
}
]
},
"nodes": [
{
"type": "action",
"title": "Return interactions",
"status": "live",
"params": {
"actions": [
{
"action": "return_interaction",
"behavior_id": "3",
"name": "Create issue in GitHub",
"interaction": "github.issue.create",
"interaction_params_json": "{}"
}
]
}
}
]
}
]
}
]
},
{
"uid": "behavior_3",
"title": "Handle Interaction with worker",
"is_disabled": false,
"is_private": false,
"priority": 50,
"event": {
"key": "event.interaction.chat.worker",
"label": "Conversation handle interaction with worker"
},
"nodes": [
{
"type": "switch",
"title": "Interaction:",
"status": "live",
"nodes": [
{
"type": "outcome",
"title": "github.issue.create",
"status": "live",
"params": {
"groups": [
{
"any": 0,
"conditions": [
{
"condition": "interaction",
"oper": "is",
"value": "github.issue.create"
}
]
}
]
},
"nodes": [
{
"type": "action",
"title": "call create github issue behavior",
"status": "live",
"params": {
"actions": [
{
"action": "switch_behavior",
"return": "0",
"behavior_id": "{{{uid.behavior_8}}}",
"var": "_behavior"
}
]
}
}
]
}
]
}
]
},
{
"uid": "behavior_5",
"title": "PARSE: Get repos with issues enabled",
"is_disabled": false,
"is_private": true,
"priority": 50,
"event": {
"key": "event.macro.bot",
"label": "Custom behavior on bot"
},
"nodes": [
{
"type": "action",
"title": "Get Repos from API",
"status": "live",
"params": {
"actions": [
{
"action": "_run_behavior",
"on": "_trigger_va_id",
"behavior_id": "{{{uid.behavior_4}}}",
"run_in_simulator": "1",
"var": "_behavior"
},
{
"action": "_set_custom_var",
"value": "{{_behavior.response_json|json_encode|json_pretty}}",
"format": "json",
"is_simulator_only": "0",
"var": "github_repos"
}
]
}
},
{
"type": "loop",
"title": "Loop over repos",
"status": "live",
"params": {
"foreach_json": "{{github_repos|json_encode}}",
"as_placeholder": "github_repo"
},
"nodes": [
{
"type": "switch",
"title": "Repo has issues?",
"status": "live",
"nodes": [
{
"type": "outcome",
"title": "Yes",
"status": "live",
"params": {
"groups": [
{
"any": 0,
"conditions": [
{
"condition": "_custom_script",
"tpl": "{% if github_repo.has_issues %}true{% endif %}",
"oper": "is",
"value": "true"
}
]
}
]
},
"nodes": [
{
"type": "action",
"title": "Save repo",
"status": "live",
"params": {
"actions": [
{
"action": "_set_custom_var",
"value": "{{github_repo.full_name|json_encode}}",
"format": "json",
"is_simulator_only": "0",
"var": "full_name"
},
{
"action": "_set_custom_var",
"value": "{% if repos is not iterable %}{% set repos = [] %}{% endif %}\r\n{{repos|merge([full_name])|json_encode|json_pretty}}",
"format": "json",
"is_simulator_only": "0",
"var": "repos"
}
]
}
}
]
}
]
}
]
},
{
"type": "action",
"title": "Save list to \"repos_with_issues\"",
"status": "live",
"params": {
"actions": [
{
"action": "_set_custom_var",
"value": "{{repos|json_encode|json_pretty}}",
"format": "json",
"is_simulator_only": "0",
"var": "repos_with_issues"
}
]
}
}
]
}
]
}
]
}
Click the Import button.
You’ll be prompted to link the GitHub connected account you created earlier.
Click the Import button again.
You should see the following:
Test the integration behaviors
Click on GitHub Bot and then click Behaviors on its card.
Open the card for the API: GET /user/repos behavior.
Click on the Simulator button at the top of the card.
Click the Simulate button.
You should see a JSON response with fields from your linked GitHub account.
You can use the simulator on the other behaviors to test them as well.
Next steps
At this point you can modify the behaviors to meet your needs. You can use the responses from GitHub’s API in your behaviors.