This article builds on the information in our Interactive API guides, please check out the WhatsApp Interactive API or Telegram Interactive API before diving in! In this guide, I will be integrating the workflow with Telegram interactive API, with notes on differences to WhatsApp.
Create the Intercom Action
First, we need to create the Intercom Action that will call the Interactive API endpoint. Navigate to Intercom Settings > Integrations > Actions. Press on Create a new action.
1. About
Write a clear name & optional description for the action.
2. API Connection
Methods: POST
HTTPS URL:
For Telegram: https://app.octopods.io/api/v1/telegram/interactive
For WhatsApp: https://app.octopods.io/api/v1/whatsapp/interactive
Headers
Add key-value pair headers:
KEY:
X-Octopods-Auth
- VALUE:<Channel API Key>
*KEY:
Content-Type
- VALUE:application/json
*To get your channel API Key, navigate to Octopods Dashboard > Intercom Workspace > Your Channel
3. Body
Ensure to include the octopods_telegram_user_id
(from Telegram) OR phone
(from WhatsApp) in your body. You can find these Intercom attributes by click on the (..) icon on the right:
Please reference to the WhatsApp Interactive API or Telegram Interactive API for more details on how to construct this. Here is the body payload we used in this example to ask the user for their preferred language:
{
"destination_user_id": octopods_telegram_user_id,
"telegram_interactive_message": {
"type": "reply_buttons",
"text": "Hello, thank you for contacting us! Please choose your preferred language:",
"reply_markup": {
"inline_keyboard": [
[
{"text": "English", "switch_inline_query_current_chat": "English"},
{"text": "Arabic", "switch_inline_query_current_chat": "Arabic"}
]
]
}
}
}
4. Test & Set Live
Add the Action to the Workflow
Once you have completed and set live the action, you can easily include it in the workflow at the place where you want to send the button message to your end-user:
1. Add step > Custom Action (using API)
And choose the Action, we just created.
2. Manage Failures
You can add an End Workflow action, or create a note for visibility if the Action failed. Note, it is very unlikely that our servers didn't pick up the request.
For safety measures, you can double down on API sending!
Bonus: Finishing the Language Example
We have been building a workflow to ask the end-user of their preferred language, let's complete that by adding a branch step and assign the conversation
โ
1. Collect Customer Reply
After Once completed, continue...
Click on Add step
Choose Collect Customer Reply
2. Branch (depending on Customer Reply
After Brach
Set First Branch to Message Content contains English
Add another Branch and set it to Message Content contains Arabic
3. Assign
Voila, done!