Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to send image using yours API? #39

Open
rafaelfelype opened this issue Apr 28, 2018 · 10 comments
Open

How to send image using yours API? #39

rafaelfelype opened this issue Apr 28, 2018 · 10 comments

Comments

@rafaelfelype
Copy link

No description provided.

@yotam180
Copy link
Owner

You can send the images (to a server) using the $ajax function we provide.

What's your use-case?

@rafaelfelype
Copy link
Author

Your api is amazing :D . I need to send an image to whatsapp automatically whenever a user sends me a message.

@yotam180
Copy link
Owner

Oh, you want to send a message to a contact? I have been trying to implement that but with no success... So for now image sending is unfortunately not supported 🙁

Sorry!

@rafaelfelype
Copy link
Author

rafaelfelype commented Apr 28, 2018

I found a way to send the location. But I'm looking for how to send images: /

chat = window.Store.Chat.add({id:window.Store.Chat.active()});
	b = chat.createMessageFromText("/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=");
	b.type = "location";
	b.lat = 0;
	b.lng = 0;
	chat.addAndSendMsg(b);

@yotam180
Copy link
Owner

yotam180 commented Apr 28, 2018

What is this base64 string representating?

/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=

How is it parsed?

@rafaelfelype
Copy link
Author

This is any base64. You just need to replace b.lat = 0; b.lng = 0;

Ex: b.lat = 40.952788; b.lng = -74.7597434;

@rafaelfelype
Copy link
Author

This catches the active chat. Just select the chat you want to send the location to.
chat = window.Store.Chat.add({id:window.Store.Chat.active()});

:)

@yotam180
Copy link
Owner

Have you tried to create a message with type "image" or something? Haven't really gotten deep into creating custom Msg objects but this looks quite promising 😄

@rafaelfelype
Copy link
Author

I tried but to no avail. 😄

@yotam180
Copy link
Owner

yotam180 commented May 5, 2018

Any updates with that? I haven't really succeeded and wanted to see if you did

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants