Is twilio mandatory to access whatsapp api - node.js

My requirement is to send whatsapp message from the web page. So, it should be a single page which will have fields To Mobile number, message and send button.
I found the documentation from facebook that we need to get whatsapp business api for this.
I also see some other tools like twilio to achieve this.
It is just confusing that, If we can achieve it using whatsapp business api itself, why we require twilio
So, My question here is, Is twilio or other third party tools really require to access whatsapp api.
Note: i am planning to do this implementation with node js.
Please clarify.

If you read the Facebook documentation deeper, you would see that direct access to WhatsApp business API is not fully available to the public. However, Facebook has partnered with 3rd party business solution providers to provide an interface for you to integrate with whatsapp. Here's a list of their partners here.
In order for you to even stand a chance of directly accessing their APIs, you need to boast of a really high traffic and voluminous users attached to your product. So your best bet is via the 3rd party vendors.

Twilio developer evangelist here.
Olamide226 is correct that you can directly access the API, but that it is easier through a partner like Twilio.
I will note that you may want to consider your exact use-case against WhatsApp's requirements for API use. Most importantly, you must get explicit opt-in from users to receive WhatsApp messages from your business.
Also, there are two types of message:
Notifications: which you can send at any time, but must match a registered template and fit within the WhatsApp defined categories listed here
Conversations: if you have received a response from a user within the last 24 hours you can send messages in any format (they don't have to match a template)

Related

Send a Google Chat message from a regular account (not a bot)?

I'm trying to send a notification out using Google Chats. But I have a few problems with the documentation I've been able to find:
It requires me to have a paid service account, which I do not have, and will not be getting
It requires using a chat bot, which (in my understanding) needs to be added to a room, and cannot just send out messages
Chat bots can't send out messages directly to personal accounts?
I'm already using Google OAuth2 authentication to access another Google API, so I'd like to use a Google API to send messages directly from the authenticated account. How would I do that?
So far:
All the documentation I can find is about making a chat bot.
I've considered some alternatives to sending out messages, but due to corporate device restrictions that will not be changing, google chats is my best option.
At the moment what you're trying to do is not possible, for multiple reasons.
You may know this already, but Google Chat is an upgrade to their old "Classic Hangouts" chat. In Google's own words, this is focused on enterprise (i.e. paid) accounts. While personal accounts are also able to upgrade and get some of the benefits, their documentation shows that Google Chat for personal accounts is very similar to the old Hangouts and most of the new features are meant for the paid accounts. This also includes the use of bots.
As you've observed, the Chat API currently only has methods to create and manage bots. There are no methods to send messages as your own account. This could be to prevent spam or because their Chat API is relatively new, since the Classic Hangouts did not have an API, and Chat hasn't fully replaced it yet. Even then, given that Chat is "enterprise-focused", it is uncertain whether or not personal accounts would get access to any new API features.
You could try to post feedback on their issue tracker or request the feature to see if you get a response, but for an immediate solution you may want to just use the Gmail API to send a regular email or reconsider the other alternatives that you had in mind.

Using the Bot Framework to post to a Microsoft Teams channel with NodeJS

Is there a way to send proactive cards from a bot to a Teams channel? The use case is a channel for service tickets. Once they get posted, a user will be able to interact with them with a few actions.
I’m looking at the documentation here for sending proactive messages. At the bottom, there’s a section for ”Creating channel conversations”, with a small reference to the startReplyChain(). However, the actual code and sample on GitHub still seem to reference a conversation with a member rather than sending something proactive to a channel.
There does appear to be documentation for incoming and outgoing webhooks, which is what I may end up doing. My only real concern is that it requires using Actionable Cards, which it references as legacy everywhere. This is despite saying that you can’t send Adaptive Cards with them. Perhaps they intend to enable these connectors to send Adaptive Cards, it’s not just very clear to me if this is a long-term solution I should be focusing on.
This is definitely possible, and it's important to note that you can even send from another process/application (e.g. on a schedule from an AWS Lamba). You can see a sample here for this.
The process of sending the message is just part of the story though - you need to have certain information already saved (e.g. in your database) to know how to contact the right user, group chat, or channel conversation, but there are a few ways to get that information. The most common is, when you bot is added to the conversation, to get it from the conversationUpdate event. You'll need conversation id, service url, tenant id, and your bot's App Id (what you get in the Azure portal for your bot, and which you're using already in your app's configuration, teams manifest, etc.). You can read more about the topic here and here.
Another option, if you don't have access to conversationUpdate (e.g. the user hasn't installed your app) is to call the Graph API to install your app. It's only possible to do this to a channel (on the v1 or beta api) (see here) or to a user (see here), but on the beta api only, and not (yet?) for a group chat.

Connect Google calendar api and api.ai

So here is what i am trying to do :
I built a bot with api.ai for my business that is hosted on my webpage and my Facebook page right now. Bot works well.
I want to push it to the next step by allowing my customers to make querys on my calendar, ask to book a specific time, see if available, if not offer other time similar, then make a booking.
I have been reading this thread and the great answer attached to it but i think my case is a bit different.
I was wondering if the bot could always have a token so every guests won't have to Auth to query the calendar ?
Obviously i am new to this, i have been reading the guide of google calendar api and api.ai but i don't really see how to do that yet. I guess there is a way to store a token somewhere and then just trigger the query with some specific intents but not to sure how.
I have also done the node.js quickstart guide of the G-calendar api, and it works fine if that helps.
Thanks for your help !
You will probably want to use a Service Account that is permitted to the calendar in question. Service Accounts are similar to regular accounts, but they are expected to do server-to-server communication only, so the method to create an auth token is a little different to keep it secure.
See https://developers.google.com/identity/protocols/OAuth2ServiceAccount for more information about using Service Accounts.
In general, you'll be using a shared secret to create and sign a JSON Web Token (JWT) you send to Google's servers. You'll get back an access token which you'll then use to call the Calendar API. The access token expires in about an hour, at which point you'll need to repeat the process.
There are libraries available to do much of this for you. For example, if you're using the node.js library https://github.com/google/google-api-nodejs-client, then it will take care of this for you (although you need to modify the key file - see the documentation for details).

How to get conversation details in microsoft bot framework for skype?

I'm able to get conversation details for webchat using https://webchat.botframework.com/api/conversations/[conversationId]/messages
Service URL for skype channel is https://skype.botframework.com, but I dont find any documentation for getting conversation details
You can use the DirectLine Rest API (see docs).
The Direct Line API is a simple REST API for connecting directly to a single bot. This API is intended for developers writing their own client applications, web chat controls, mobile apps, or service-to-service applications that will talk to their bot.
Within the Direct Line API, you will find:
An authentication mechanism using standard secret/token patterns
The ability to send messages from your client to your bot via an HTTP POST message
The ability to receive messages by polling HTTP GET
A stable schema, even if your bot changes its protocol version
You need to enable the DirectLine channel for your bot on (see screenshot)
You don't have to access each specific channel endpoint separately, you can do it all (with some limitations) through the DirectLine API.
Start a New Conversation
POST /api/conversations
Get Messages in a Conversation
GET /api/conversations/{conversationId}/messages
Send a Message
POST /api/conversations/{conversationId}/messages
The full details are in the docs as linked above.
Hope this helps
Can you be more specific about conversation details and what you're looking for?
Generally, you shouldn't assume those URL's are static BTW; an incoming message from the Bot Framework will have a ServiceURL that should be used for the life of that conversation. Some services may have multiple ServiceUrl's that they give out for different users.

Is there anyway to send WhatsApp message using node js?

Is anyone aware about api that can be used to send WhatsApp message using node.
Api like whatsmate have stopped their premium services and only provide trial account.
There is no official whatsapp API, whatever you can find on the internet is "illegal" and whatsapp will ban them eventually. Check this one API who was quite good at the start:
https://github.com/venomous0x/WhatsAPI

Resources