#Ganti token dan chanel screet mu! di file app.py
# Channel Access Token
line_bot_api = LineBotApi('ISI TOKEN OD KALIAN')
# Channel Secret
handler = WebhookHandler('ISI CHHANEL SCREET')
- sudo apt-get install heroku
- sudo pip install line-bot-sdk
- sudo pip install flask
- curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
- git clone https://github.com/Aditmadzs/oalinebot
- EDIT TOKEN + SECRET DULU
- Buka folder git kalian
cd oalinebot
- Login Ke Heroku
heroku login
- Buat aplikasi di heroku
heroku apps:create nama
- Git Remote Ke Heroku
heroku git:remote nama
- Init ke git
git init
- Tambahkan git
git add .
- Lalu commit
git commit -m "Aditmadzs"
- Push ke heroku
git push heroku master
- Masukan Webhook URL
nama-aplikasi-di-heroku.herokuapp.com/callback
-
Tambahkan /callback dibelakang link webhook URL
-
Jalankan app.py
python3 app.py
message = TextSendMessage(text='Hello, world')
line_bot_api.reply_message(event.reply_token, message)
message = ImageSendMessage(
original_content_url='https://example.com/original.jpg',
preview_image_url='https://example.com/preview.jpg'
)
line_bot_api.reply_message(event.reply_token, message)
message = VideoSendMessage(
original_content_url='https://example.com/original.mp4',
preview_image_url='https://example.com/preview.jpg'
)
line_bot_api.reply_message(event.reply_token, message)
message = AudioSendMessage(
original_content_url='https://example.com/original.m4a',
duration=240000
)
line_bot_api.reply_message(event.reply_token, message)
message = LocationSendMessage(
title='my location',
address='Tokyo',
latitude=35.65910807942215,
longitude=139.70372892916203
)
line_bot_api.reply_message(event.reply_token, message)
message = StickerSendMessage(
package_id='1',
sticker_id='1'
)
line_bot_api.reply_message(event.reply_token, message)
message = ImagemapSendMessage(
base_url='https://example.com/base',
alt_text='this is an imagemap',
base_size=BaseSize(height=1040, width=1040),
actions=[
URIImagemapAction(
link_uri='https://example.com/',
area=ImagemapArea(
x=0, y=0, width=520, height=1040
)
),
MessageImagemapAction(
text='hello',
area=ImagemapArea(
x=520, y=0, width=520, height=1040
)
)
]
)
line_bot_api.reply_message(event.reply_token, message)
message = TemplateSendMessage(
alt_text='Buttons template',
template=ButtonsTemplate(
thumbnail_image_url='https://example.com/image.jpg',
title='Menu',
text='Please select',
actions=[
PostbackTemplateAction(
label='postback',
text='postback text',
data='action=buy&itemid=1'
),
MessageTemplateAction(
label='message',
text='message text'
),
URITemplateAction(
label='uri',
uri='http://example.com/'
)
]
)
)
line_bot_api.reply_message(event.reply_token, message)
message = TemplateSendMessage(
alt_text='Confirm template',
template=ConfirmTemplate(
text='Are you sure?',
actions=[
PostbackTemplateAction(
label='postback',
text='postback text',
data='action=buy&itemid=1'
),
MessageTemplateAction(
label='message',
text='message text'
)
]
)
)
line_bot_api.reply_message(event.reply_token, message)
message = TemplateSendMessage(
alt_text='Carousel template',
template=CarouselTemplate(
columns=[
CarouselColumn(
thumbnail_image_url='https://example.com/item1.jpg',
title='this is menu1',
text='description1',
actions=[
PostbackTemplateAction(
label='postback1',
text='postback text1',
data='action=buy&itemid=1'
),
MessageTemplateAction(
label='message1',
text='message text1'
),
URITemplateAction(
label='uri1',
uri='http://example.com/1'
)
]
),
CarouselColumn(
thumbnail_image_url='https://example.com/item2.jpg',
title='this is menu2',
text='description2',
actions=[
PostbackTemplateAction(
label='postback2',
text='postback text2',
data='action=buy&itemid=2'
),
MessageTemplateAction(
label='message2',
text='message text2'
),
URITemplateAction(
label='uri2',
uri='http://example.com/2'
)
]
)
]
)
)
line_bot_api.reply_message(event.reply_token, message)
message = TemplateSendMessage(
alt_text='ImageCarousel template',
template=ImageCarouselTemplate(
columns=[
ImageCarouselColumn(
image_url='https://example.com/item1.jpg',
action=PostbackTemplateAction(
label='postback1',
text='postback text1',
data='action=buy&itemid=1'
)
),
ImageCarouselColumn(
image_url='https://example.com/item2.jpg',
action=PostbackTemplateAction(
label='postback2',
text='postback text2',
data='action=buy&itemid=2'
)
)
]
)
)
line_bot_api.reply_message(event.reply_token, message)
- Arsybai