Last active
February 26, 2021 21:45
-
-
Save xakpc/1f4b0377231ab46b6b369be99d15a2ab to your computer and use it in GitHub Desktop.
Code-samples for API.chat blogposts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -v -X PUT "https://bot.api.chat/v1/bots/botName/scenario" | |
-H "Content-Type: application/xml" | |
-H "Cache-Control: no-cache" | |
-H "Ocp-Apim-Subscription-Key: your-subscription-key" | |
--data-raw ' | |
<bot> | |
<states> | |
<state name="Start"> | |
<transition input="hello" next="Start">Hello from chatbot</transition> | |
<transition input="*" next="Start" morphology="msg">You send me {msg}</transition> | |
</state> | |
</states> | |
</bot>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -v -X POST "https://bot.api.chat/channels/viber/yourBotName" | |
-H "Content-Type: application/json" | |
-H "Cache-Control: no-cache" | |
-H "Ocp-Apim-Subscription-Key: your-sub-key" | |
--data-raw '{ | |
"AuthToken": "your-token", | |
"SenderName": "name-of-answers-sender" | |
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Bot Deploy | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
deploy: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v2 | |
- name: Set demoBot scenario from repository | |
env: | |
SUB_KEY: ${{ secrets.SubscriptionKey }} | |
BOT_NAME: "demoBot" | |
BOT_FILE: ./default.xml | |
run: > | |
curl -v -X PUT "https://bot.api.chat/v1/bots/$BOT_NAME/scenario" | |
-H "Content-Type: application/xml" | |
-H "Cache-Control: no-cache" | |
-H "Ocp-Apim-Subscription-Key: $SUB_KEY" | |
--data @$BOT_FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment