I am new in Twilio and want to use it for connecting an existing chatbot to WhatsApp. Setting up a basic bi-directional message exchange (using the Twilio sandbox) turned out to be quite simple. I use node.js + Express in combination with the npm twilio package.
The chatbot is set up stateless. Therefore, what I need is a mechanism to keep track of the state the chatbot is in for a particular user.
Question: is it possible to send session state info (session data) back and forth with the WhatsApp message flow?
Not sure if this behavior also applies to the WhatsApp message flow, otherwise the answer is no. Curious on your findings.
How do Twilio cookies work?
https://support.twilio.com/hc/en-us/articles/223136287-How-do-Twilio-cookies-work-
I submitted my question to Twilio Support; below is (part of) the answer I got.
Twilio Support:
Unfortunately, our WhatsApp integration does not support cookies. Instead, I would strongly recommend our Conversations API:
https://www.twilio.com/conversations
https://www.twilio.com/docs/conversations/api
https://www.twilio.com/docs/conversations/quickstart
This would allow you to create meaningful connections with customers across channels. You could integrate Twilio autopilot to build an intelligent chatbot.
https://support.twilio.com/hc/en-us/articles/360012060714-Getting-Started-with-Twilio-Autopilot
https://www.twilio.com/autopilot
https://www.twilio.com/docs/autopilot
Related
I have a service that listens for certain updates and then uses a Discord Bot to post a message on a channel. A random example: every time a team scores a goal, post a message in a channel. I got an email from Discord to reset my bot token because there were too many logins.
As you know, in order to use the Bot you use the client.login("XXX") method. So every time there is an update my service initializes the bot and then sends a message. My assumption is that it has to do with me calling client.login("XXX") for every update. Since my service runs serverless, I can not keep the service up.
Is there a way to make the bot post a message without having to use client.login("XXX")? Or can anyone suggest any strategy to make this logic work?
That is not possible as a bot cannot do any actions without being logged in, it sounds like channel webhooks would fit your needs better.
You simply generate a webhook link in a channel which you can then post messages to through a post request.
You can read more about webhooks here
And you can read more about the required paramters and how to format a POST request to the webhook here
I have a PERN(Postgres, Express, React, Node) e-commerce app. I want to notify a user that the payment is successful by redirecting to a payment successful page after a user scans QR code to pay.
However, I'm not sure how do I achieve this.
Currently, after the user completed a payment, I will receive a REST's POST request for payment confirmation from a bank API. . However, I'm also using GraphQL and I think that Graphql's Subscription could be what I'm trying to achieve.
Does anyone know how am I supposed to achieve this?
Are there anyways to send a request from REST to Graphql on my own server?
Or are there any better ways to do this?
Just like what is done in this video:
Do I understand correctly that you are looking for a way to notify your client that the payment was successful?
I assume you know how to handle redirect logic so here are the ways you can notify your web-app from the server.
1. Regular HTTP request
The client sends a regular HTTP-request to your server and you withhold the response until you received the 'payment completed' request from the bank API. If your request times out before the bank API confirms the payment - you simply send the same request again. This pattern is also known as Long Polling
2. Server-Sent Events
Your client can open a channel to your server that allow your server to send Events to your client (one-way). It is fairly easy to implement and a solid way to handle one-way communication. Check out the MDN documentation.
3. Web-Sockets MDN
You are probably familiar with these since they are the de-facto standard nowadays. Similar to Server-Sent Events but they allow two-way communication.
Most libraries that handle client-server communication implement a combination of these technologies in order to provide a fallback solution. I would recommend to stick to one of these libraries as they handle many edge-cases that are otherwise work-intensive to cover.
As you pointed out, if you are already using GraphQL you can simply use its subscriptions api. It uses WebSockets with a fallback to long-polling underneath.
Other popular options include socket.io or graphql-sse.
I am getting lost in all the documentation available on my first time attempting to set up a Microsoft Teams bot. I have it set up and able to write command activated messages in personal, groups and teams. I need to transition this to be able to receive a payload of data (the data that I will use to populate my activity card), but I can't figure out how am I supposed to let the bot know which Group or Team the payload is ment for.
The payload will be sent from my Azure hosted API, to the endpoint of my Bot. It should then, with some data in the payload I suppose, know which group or team to sent the processed activity card to?
If you could provide me with the documentation I need to read up on, or further explanation on how to proceed, I would greatly appreciate it.
You can listen to teams bot for incoming calls,
Bots can interact with Teams calls and meetings using real-time voice, video, and screen sharing. With Microsoft Graph APIs for calls and online meetings, Teams apps can now interact with users using voice and video to enhance the experience. These APIs allow you to add the following new features:
Interactive voice response (IVR).
Call control.
Access to real-time audio and video streams, including desktop and app sharing.
please check this doc for more info and sample
I apologize for the delay in responding to you.
I read the documentation you sent, but I am not sure how it relates as I do not need real-time voice, audio or screen sharing capabilities.
I can understand that the title writing "incoming calls" could be cause of misunderstanding, however, the issue is as described that I need to forward a payload from my API endpoint that needs to be received in the Teams Bot that listens to that specific payload. I don't know how to approach a solution for that part, after that part the Teams Bot should then sendActivity with an activity card attachment (this I have prepared already using dummy data and the card designer for layout), containing that payload data, to the group/team that the Teams Bot is active on.
I resolved this using the answers from this thread:
Programmatically sending a message to a bot in Microsoft Teams
Specifically thanks to the message from #Hilton Giesenow:
https://stackoverflow.com/a/59439602/10429879
I'm making a dialogflow agent that will be integrated with various platforms (Facebook messenger, slack and maybe a few others) that will have the basic functions of a informational chatbot.
The agent will be for a specific store and I'm wondering if it's possible to trigger some sort of welcome message once the user enters the geofence (in this case, the store)?
Thanks for the help. I haven't found any documentation for this on dialogflow specifically or anywhere else so anything will be awesome.
Note: I'm am not by any means dead set of dialogflow, if AWS Lex offers something like this and it's better, I will take a look. I'm just a bit more used to dialogflow.
This cannot be achieved just by using either Lex or Dialogflow. Because at the end of the day, you are using them to integrate with Messenger/Slack/Whatsapp and these apps will (for obvious good reasons) not share the user's location information with the bot. You will need a helper app which takes the user's location permission as well and triggers the bots for you.
Keep in mind that channels like Messenger and Whatsapp have restrictions over sending messages willy-nilly to users. Messenger has a '24+1' policy Whatsapp also you can only send free form messages in the 24 hour window. But after that you can send chargeable pre-approved "hsm" message templates.
I have a bot for Slack implemented using RTM (https://api.slack.com/rtm) which works well but requires WebSocket connections for each user active all the time. After rewriting it using new Events API (https://api.slack.com/events) the bot works well too but appears "away" all the time. Apparently Slack determines bot's status by checking WebSocket connection which is not good as my goal is to use Events API only. Is it possible to use Events API and make a bot appear "online"?
It's one of the two reasons that we don't move to Events API for our bot. The second is that typing events are not send with Events API.
For what we know (dev4slack community, Slack's direct contacts), Slack works at make able to indicate online presence without the RTM, for bots using Events API. That seems essential, without that, Events API seems to be a half solution.
Now with the RTM gone. Slack announced that the only way to toggle your bot presence is via the app management page.
Official Tweet here.