I am trying to create a Viber Bot and looking for the method that can run through all subscribers I have in the specific Public account
I checked out all methods from Documentation but haven't found anything like "get_all_subscribers" or "get_all_users". So as far as I understood I have to set up callbacks for subscriptions. And to work around this data
{
"event": "subscribed",
"timestamp": 1457764197627,
"user": {
"id": "01234567890A=",
"name": "John McClane",
"avatar": "http://avatar.example.com",
"country": "UK",
"language": "en",
"api_version": 1
},
"message_token": 4912661846655238145
}
So am I missing some methods and it's possible or I should work around callbacks only?
According to viber documenation Viber API
We recommend that you record the subscriber ID of each subscriber, as there’s no API for fetching all subscriber IDs for your bot. You can find the subscriber ID in the sender.id property of the Message callback, or the user.id property of the Subscribed callback. You can see whether a user is subscribed in the subscribed parameter of the conversation_started callback. Note that users’ first message to the bot will make them subscribed, but will not result in a Subscribed callback.
You can get information about your subscribers using Get Account Info endpoint.
Its response contains subscribers_count and members (list with fields: id, name, avatar and role).
P.S. the only thing that you need to check is if the public account subscribers are chat bot subscribers too.
Related
I use Twilio [currently sandbox] for WhatsApp API.
I post to webhook when message is arrive to sandbox, I get data like this:
{"SmsMessageSid":"xxxxxxxxxx","NumMedia":"0","SmsSid":"xxxxxxxxxx","SmsStatus":"received","Body":"try1","To":"whatsapp:+14xxxxxxxxxx","NumSegments":"1","MessageSid":"xxxxxxxxxx","AccountSid":"xxxxxxxxxx","From":"whatsapp:+97xxxxxxxxxx","ApiVersion":"2010-04-01"}
Is there a way to get the username?
WhatsApp Facebook API does have a name in the payload:
{
"contacts": [ {
"profile": {
"name": "Kerry Fisher"
},
"wa_id": "16315551234"
} ],
"messages":[{
"from": "16315551234",
"id": "ABGGFlA5FpafAgo6tHcNmNjXmuSf",
"timestamp": "1518694235",
"text": {
"body": "Hello this is an answer"
},
"type": "text"
}]
}
Source: https://developers.facebook.com/docs/whatsapp/api/webhooks/inbound
Talking to Twilio my team got the response bellow:
Twilio does not manage a user database. Although this is a data
variable on the WhatsApp API, we are not leveraging it immediately as
it is not mandatory from the WhatsApp docs and our data structure may
not fully support this yet.
Again the Beta Nature of the Product will unveil product needs and
features in which we have not moved forward with how or if we plan to
support this.
There is at least one provider that I know that has this feature.
For me looks like Twilio recycled all the architecture they have for SMS without any regret of any drawbacks. We just found one, the absence of WhatsApp username in the message payload.
I reached Twilio asking for a deadline for this feature but until now I didn't receive any news yet.
The From is the WhatsApp username, do you mean how to programmatically extract the username (and if so, is there a particular language you are using)?
"From":"whatsapp:+97xxxxxxxxxx
There is no username, all you will get is the number of the user that sent the message, which is the "From" value, unless the sender tells you its username through the message body.
i try to add attendes to a google-calendar-event.
If i log in via my personal account (OAuth2), everything works.
But if i try to do this via a service-account, i got the error:
{
"code": 403,
"errors": [
{
"domain": "usageLimits",
"reason": "quotaExceeded",
"message": "Calendar usage limits exceeded."
}
]
}
I found a blog, where someone wrote, that you need quota to add attendees
and service-accounts dont't have any quota. This should be the issue.
But this is no solution for me, because i want to add some attendees by a
server-to-server-request. It's only about 2-5 attendees and only one or two
times a day.
Is there any other way to add attendees by a server-to-server-request?
Best regards,
alex
The reason is general issue when creating calendar events with attendees using a service account, see here.
Right now the best workaround would be letting the service account impersonate a user, so it looks like it was the user and not the service account who created this event.
I have setup a fully operational chat bot in Hangouts Chat orchestrated by a tailored webserver. I would like now to be able to have this webserver to interact with other Hangouts bots that I created and to route some requests to some of my other servers that will have to know which bots initiated the event.
With other provider, such as Slack, the app_id is provided in the event request data.
But with hangouts, this is not the case. I could not find any data in the request body or headers that represent either project_id or client_id.
In a more simple way my question is : "How to identify the Hangouts bot that send me an event request?" :)
An event request's response will contain an Event instance in its body, which one of its fields will be an User object. That User object will contain a name field that will represent the user's id (whether it's a human or a bot).
It will look like this:
{
"name": "users/<id>",
"displayName": "<name that appears in the chat>",
"type": "BOT"
}
One month later, I finally found the time to answer my question :)
In order to identify the Hangouts project that is calling your server, when you receive an event from Hangouts Chat, you'll find in the incoming request the header Authorization whose value is something like Bearer abcd1234.
If you decode this JWToken (ie, abcd1234 in our example), in the resulting data, you'll have a field aud which is exactly the "project number" of your Hangouts app. This "project number" can be found at "https://console.cloud.google.com/home/dashboard?project=referenceofyourprojecthere".
I have a webhook subscribed to Page feed events.
I want it to tell me when a public event has been created on the page OR a page the user manages.
The app dashboard tells me this is the JSON object that will get sent to me:
{
"field": "feed",
"value": {
"item": "status",
"post_id": "44444444_444444444",
"verb": "add",
"published": 1,
"created_time": 1536110879,
"message": "Example post content.",
"from": {
"name": "Test Page",
"id": "1067280970047460"
}
}
}
Is the event id delivered in the post_id field?
If not, how is it passed to me?
How can I test this further?
Is my only choice to create events by hand, record the event id and fill it in as the returned post_id?
Can this webhook receive notification from multiple user's pages?
If so, how do I configure it to do so?
If not, how do I do something like that? Do I need multiple webhooks?
As per relevant webhooks doc reference https://developers.facebook.com/docs/graph-api/webhooks/reference/page/#feed
event_id is not delivered in the post_id.
event_id is passed inside value as event_id, you may need to check you app, seems like event_id is being filtered out in the response.
Testing it further is a broad query, although you could use curl to perform testing with the configured FB account.
In a more generic context, the above webhook response can be used to autogenerate/handle the post, that is the core purpose of the existence of the webhooks(to trigger and automate events as and when occurred).
No, this webhook is page specific.
You need to configure the webhook for each page separately. (Find the page_ids that can be used to work with other pages corresponding to the user)
The same webhook shall work, although the only difference shall be the page parameter, so you would have to configure another set of webhooks for each page, with a unique page_id related to that user account.
Note: Refer to https://developers.facebook.com/docs/graph-api/webhooks/getting-started for testing the webhooks.
i am trying to send messages through Amazon alexa via a bot-user to an already created chat bot that is within the workspace already.
after using webhooks i realised the chatbot does not recognize the messages i am posting through my bot-user.
my problem solving attempts included:
using the "as_user" method set as true. so messages are sent by the user but it seems to only visually change the name of the bot-user and my chat bot still does not respond to my messages.
is it even possible for a bot-user using slack web API to communicate to an App-bot that is within a channel on a workspace? I am using Postman to test. i suspect it has something to do with he scopes of the bot-user and the chatbot within the workspace just not being able to see the bot-user scope. This is all within the slack web api and this is how i am communicating with the workspace through the bot user.
see images to illustrate.
thanks alot hope you can help! :)
First image of postman:
second image of slack intentions:
Messages from real users look slightly different then message from bots / apps.
Apparently your chatbot is ignoring messages that are not coming form a real user. So the only way to "fix" that would be to modify the chatbot logic.
Example for message from real user:
{
"type": "message",
"user": "U12345467",
"text": "Good read for some of guys",
"ts": "1531745292.000021"
}
Example for a bot message:
{
"text": "Hey guys",
"bot_id": "B12345678",
"type": "message",
"subtype": "bot_message",
"ts": "1531700187.000049"
}