How to get message by message_token using Viber REST API? - rest

I'm building the Viber bot which will be served using different services. One of the problem is about getting the exact message which has been sent to the user.
The "received" event gives message_token, so I wonder if it's possible to use it in order to get the message.
Or I have to use my own mechanism of sync?

Viber message_token is an identifier for peer-2-peer connection between Viber server and/or your local or online server and not the actual message. Moreover, there is no "buffer" for messages to be stored both locally or online. There is an internal process to store message when recipient is offline and then resend message when it is got online but I couldn't find direct access to them.
I did something similar by storing incoming messages to SQL using datetime (milliseconds) as timestamp in order to identify the message. However, you can combine Token also for knowing the session or to be more specific user_ID, both are unique.
Hope that helps to work around your problem...

Related

Send emails from flutter application without expenses or smtp server and without opening the gmail app

As the title says, I would like to know if there is any way to send emails without having to use an external service, that charges me for sending the messages, or having to use an SMTP server in which each user has to be registered.
I have also seen pages like email.js but I don't want to have to pay for that if there is a possibility to do it on my own. It is also not useful for me to open the Gmail or messaging application of the device itself since I already know how to do that and it is not what I want.
For better understanding, I will give an example of what I want to do.
What I want is that from my application the user writes a message and from there that email message is sent to several different users from a list, without having to log in or anything, since the emails will be sent from my own email account. gmail that I have specifically created for the application.
I have seen the smtp server but from the information that I have seen that server implies that I have to log in to be able to have the token and that is not what I want because I want that once I configure everything there is no need to do anything else that people receive your messages and that's it.
I don't know if this is possible but I hope someone can help me.
Sending emails without your user logging in would require you to have either the credentials stored in the app (which is unsafe) or use a custom backend server that will host all the credentials that cannot be extracted. I would advise going with the backend route because it is easier to setup and your application will simply perform a HTTP request to get it done.
From the documentation of the mailer package, you can implement the server method pretty easily and get it moving. You will have to find a free web hosting service to deploy to.
There would really be otherwise no other way to get what you desire for virtually free.

How can I get last message of each conversation(per JIDs) from openfire?

I'm developing an instant messaging app on android with SMACK library that uses OPENFIRE as a xmpp server. I want to get last message of each conversation from MessageArchiveManager in openfire server that was enabled by MONITORING SERVICE plugin(based on XEP-0313).
I know that mamManager.queryArchive() can gets the messages that related to specific jid or can get a specific number of messages that exists in server(with no custom sepration), but we suppose that smack doesn't knows which JIDs has conversation on server!
One solution is that send request per each ROSTER entry, but it has heavy cost when it contains numerous contacts and perhaps we have a conversation with anybody out of Roster. Is there any way or plugin or another extension to do this?

How to specify SMS URL for specific text message

Is there a way when using the REST API to send an outgoing message that I can specify the SMS Url to use for any responses to that message? I saw mention of it in the docs where it says you can specify it for the phone number in the console or via the API. If I post a variable named SmsUrl when sending the text it still uses the url connected to the number or the twilio app.
We need responses to submit back to a url on our server that includes a parameter that lets us connect the response to a specific inspection request. In other words we need to be able to connect the response not to the from number but to the record on our end for which the outgoing message was triggered.
Thanks
If you are sending from a single number this is totally impossible, SMS simply doesn't work like that. If you send me 5 SMS and then I reply to one of them my reply contains no data which links it to the SMS I am responding to.
The only ways I can see you achieving this are:
Assign a different outgoing number to each trigger. This is foolproof
but may not be viable depending on your usecase and nuber of
triggers. It may also confuse your users if they get texts from many
different numbers, although if you buy consecutive ones you could
mitigate this.
Include instructions in your SMS like "Reply 1 to request a call, 2
to request a password reset..." or "Start your reply with XXXX" where
XXXX is a unique code you generate server side and assign to the
user, or have a code for each trigger or whatever. This would work
with only one outgoing number, but in my experience the end users
will screw it up a lot of the time and not respect your instructions.

Modifying the XMPP Presence Stanza

In XMPP user can send subscription request to another user to add in roster, I am easily doing this even working perfectly if user is offline server automatically dispatch this presence when user come online.
But I need to add a custom tag to this presence, it works till user is online, if user is offline the server send the regular presence without my custom tag when user arrives online.
How to achieve this.
It looks like the XMPP server you are using does not store the extended info of the presence. According to RFC6121 3.1.3.4 the server must store this info:
http://xmpp.org/rfcs/rfc6121.html#sub-request-inbound

Pre-Approval of iOS Text Messages

Although Apple doesn't allow apps to send text messages without explicit user permission (unlike Android, which just requires you to ask for permissions like this when installing the app), I was wondering if anyone had any ideas for other ways to get around this issue. Specifically:
Is it possible to allow the user to pre-approve a specific text message, and delay sending it until the desired time?
Can an external client be used? Ex., ping a server to do the work of sending the text message for the user? This seems like it will get ugly quickly though (since provider info is required), and would require the user to have internet access, not just cell signal. However, perhaps the application can require an initialization text.
The goal here is to send a specific text message for the user when they are unable to do so themselves, so naturally, having them pre-approve the message would be impossible.
You can't send text messages directly from the device.
But I think there is no problem sending them from a webserver, however your app needs to have an internet connection to do this and I am not aware of a service, which allows you to send text messages for free, so you need to pay to provide this service to your users (I can't say if it is ok for Apple to charge your users for such a service). Another drawback of this solution is, that the sender of the text message wouldn't probably be the users number.