Skip to content

Instantly share code, notes, and snippets.

@xakpc
Last active February 26, 2021 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xakpc/1f4b0377231ab46b6b369be99d15a2ab to your computer and use it in GitHub Desktop.
Save xakpc/1f4b0377231ab46b6b369be99d15a2ab to your computer and use it in GitHub Desktop.
Code-samples for API.chat blogposts
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>'
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"
}'
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