For those that want to create bots without having to code much on their own: https://medium.com/@lolo_code/lets-create-a-whatsapp-openai-gpt-3-bot-in-7-minutes-with-serverless-in-lolo-for-free-dc8cfe4b0a94
#GPT-3 + WhatsApp + Serverless + Low Code = 😎
163 messages · Page 1 of 1 (latest)
thanks, working really well since yesterday. i had to re-tick storage feature cuz i was getting a lot of error 400, then its working flawlessly.. newcomers.. remember this bot is using GPT-3 not chatgpt. dont expect long and explained awnser (as my whatsapp friends lol).. thanks for this Lolo
Is there a way to turn this into a full mobile app? Or is it just stuck running on lolo?
Creating a bot, does that make a new whatsapp user? Or do you need a existing one?
I think you need an existing one
oh :/
@quiet crane
WhatsApp itself gives you a user you connect to. You get a test number by following the tutorial by Meta. I'm sure you can add additional numbers in Meta to connect to. Lolo works as a middle man interpreting the message and sending it back. In this way we take it process it, connect to OpenAI and then send a webhook back.
So I don't need a number for it
Yeah that one is not bulletproof for long messages. You can play around with max tokens to enable longer messages but chatgpt and gpt-3 is not using the same api endpoint. chatGPT is also allowing conversational_id which makes it simpler to get that back and forth feeling of a conversation.
You get a number from Meta, so you do need a number to send to but that one is free. Go through the start of the tutorial, create a meta dev account and set up whatsapp and you'll see a number you can use under Getting Started.
Lolo
@quiet crane
Not sure exactly what you mean... You want to build a frontend to connect the bot to? Think of Lolo as your backend so in the case you'd like to build a mobile app, you could set up a websocket or create an api instead. You'll have to give me a bit more information on what you want to achieve though.
If you want to set up a websocket see this guide: https://docs.lolo.company/docs/draft-simple-websocket-application
If you want to create an api see this hello world guide: https://docs.lolo.company/docs/creating-an-application
Then you would just connect the OpenAI (beta) node in these workflows.
Lolo Company
A Simple WebSocket Application in Lolo Code A webSocket is mainly used to create real-time applications, such as chat apps, collaboration platforms and streaming dashboards. These applications take advantage of two-way/bidirectional communication between a server and users’ browsers. Using Lolo for ...
Lolo Company
How to Create a Hello World Application This guide helps you build a simple Hello World Application, where we send a HTTP GET request and receive a Hello World response from the Lolo Application. It helps you understand how you can work with Library Functions, route data between nodes, use state and...
After following the tutorial, I see the bot receives the message but I get an error and don't get the response
same here
error 400 from post msg on lolo
Well I was hoping to just swap out WhatsApp with the default texting app for android, then use it as a backend for an app (I haven't really tested Lolo yet, as I am at school, but it looks cool)
Ok so I see there is no sms support
Hmm I can't really find what I need, so I will probably find a different tool (suggestions are welcome) but it looks like a great site that you have!
Try to create a new meta token. Is it a 401 error? Then it’s Auth.
De-tick the history for the OpenAI config and then create a new meta token. See if this solves it. Could you share your logs as well?
You can simply connect to twilio but you’d have to set up the connection yourself. Lolo is great for your backend but we’re still very young so don’t have a lot of prebuilt stuff yet, users have to create a bit on their own. But it’s just nodejs within the nodes so it’s simple to connect to any npm library.
Ok. But the thing is I want it to read the user's incoming messages, and send through the users number
Instead of twillio
You mean to just use text sms instead of WhatsApp? You’d have to set up your own sms service, not impossible but you’d need some kind of api from a telecommunication service to connect to the device no? This is essentially just nodejs code within the nodes, where you route data between the nodes using event driven architecture so what you can do with nodejs you can do here.
Now I just have to learn nodejs
Ezpz
Yes don't store Prompt History with WhatsApp, doesn't seem to work all that well. We've used it with Slack a bit better. See if OpenAI will release the ability to send in conversion_id in the future to make it easier to get that feeling of a back and forth conversation. But for now, de-tick it and save/run your app again.
okay fixed it! I had a typing error in openAI model on lolo
sorry dont want to leak my number haha but thanks!
@quiet crane. How do I change the profile pic of the bot on WhatsApp? I never worked with meta apps...
Not sure this will work with test numbers, you'll need to get a real number. Then you should be able to configure the settings for that number under account tools and then phone numbers at https://business.facebook.com/
Writing to a test number is free though in WhatsApp, not sure about the pricing for buying a number via Facebook. Creating Slack apps seems to be a lot simpler in general. Check out a guide for creating slack apps with GPT here https://medium.com/aws-tip/take-6-minutes-to-create-a-free-openai-gpt-3-bot-via-a-slack-with-serverless-in-lolo-b99509ffbca and here https://medium.com/aws-tip/creating-a-question-answer-conversation-with-a-gpt-3-openai-bot-in-a-slack-channel-via-serverless-48a572abd124 - lot easier to customize and simpler to set up.
@quiet crane is still working? last days i been using and worked very well but today i tried and nothing happened.. i checked log and no error message, nothing happen. tried stop and run and same result..
i didnt change anything though.. just realized this is giving me bad request
This one looks to be coming from the WhatsApp trigger for the incoming Webhook from WhatsApp. This one is saying that the signature or payload is empty. Try to redo the whatsapp webhook and then if it isn't working still let us know.
Hello @quiet crane .. I'm also facing the Bad request issue, tried your solution with no luck. any fixes yet?
@quiet crane
You have been warned and muted by AutoMod.
if ive created a whatsapp chatbot locally in vscode how do i use the meta number? is it possible?
huh?
You should be able to use it via WhatsApp. You followed the tutorial all the way through?
You're testing it via WhatsApp with your Meta test number correct? If you try to call this endpoint you'll get an error as it isn't coming from WhatsApp.
You followed the tutorial all the way through correct? There is a Discord link in the console to the left. If you're having issues you can speak to Jesper that set this one up directly there. But just make sure you only test the app via whatsapp and don't try to call the endpoint directly as it will give you an error if the payload is incorrect (Whatsapp will send signature with the request).
We've improved the logs, so save your app again and then run it. You should be able to get more info from your error messages.
this is amazing tutorial, thanks for making it, but the link for Discord in the article is expired
Will update the link. There is a link to Discord in the Lolo Console that should never expire as well. 😁
hi! first of all, I want to say thank you! this bot works wonderful!
Now I'm thinking of adding dall-e support on this as well (seeing that at lolo, there is a dall-e support as well). Is there any way to do that in one business number? Or should I create two numbers? One for davinci, and one for dall-e?
or, is it possible that the lolo console recognize some words entry (for ex. "/dalle") in front of a message, and when that happens, it resorts to sending the input to dall-e API instead of davinci (and resend it back to us via whatsapp)?
Yeah of course, you just need to set up an if statement in between the incoming message and then route the message by recognizing if the text is asking for an image or if it is a standard completion request. Create a new function and then use the event object in that function to decide where to route data. In the example screen I haven’t added DALLE yet but you can simply add it and route it just like you are doing with the OpenAI Completions node. Just remember that DALLE give you a slightly different output, I.e. an url ({event.response.data.data[0].url}).
why my bot acting weird?
Wow that looks really bad. Can you send me your logs? Also please de-tick the Store Prompt History in the OpenAI function for now. Test it again after you've saved and deployed again to see if that fixes it. Not sure if it is that causing issues with the Store Prompt History, if you change the topic it can have a hard time interpreting a new question with a new topic as that option is sending on your previous questions and answers within the prompt itself.
If it is a problem with the WhatsApp trigger going off multiple times which can happen if you've erased messages then join us in our Discord and I'll connect you to Jesper who built the trigger who can help you figure it out.
thank you so much for the insight! To be honest I'm not a code developer at all, just an enthusiast, so I really appreciate your help!
I'm going to tinker a bit then, and see where I can go
@quiet crane , turns out, not a code programmer I am, I still unable to connect things.. hahaha... I tried applicating the things you put on the "serverless slack to generate Dall-E" (which I tried and succeed) to the whatsapp side using if, but it doesn't work.
If possible, (and when you have time as well, of course) could you make a guide regarding combining davinci text and dall-e in one loloco app?
Or, if anyone here already made it, could you share what code I have to type on?
And before I forgot, I really appreciate the tutorial you make, since it really helped us who have almost zero experience in coding like this 👍
@quiet crane , finally I am succeed in generating dalle images, but I can only send it as a text link (as shown in pic). Well, if I click the image, it is showing the image, but is there any way to send the image instead of a hyperlink? what command should I put in here? (since changing "text" to "image" doesn't work)
Hmm... This one is sending back a hyperlink to WhatsApp? Could you send me a screen of what this looks like in WhatsApp?
@quiet crane
If I click the image, it will show the image generated by dalle
But is there any way so the object sent is image instead of a hyperlink to the image as shown above?
Alright let me check this and get back to you.
Looks like the function we've built doesn't support this at the moment. Jesper the guy who build the WhatsApp trigger just let me know. I'll get back to you if we manage to fix this or have a workaround.
thankss, now its work! it turns out I forgot to input some data there graph😅
anyway, can we make it respond reply massage?
No problem! Even reaching to this stage is already a breakthrough for me... Again, thank you so much for the support!
Hi, how can get this Whatsapp bot?
you need to make it yourself using the tutorial given on the first post
btw, @quiet crane , is it possible to share the test business number to other person? Or is it connected only to the "registered" number that is put on FB Business? Since I encounter "AxiosError" when other number try to send a message there (I share the FB test number to one of my family to test as well).
If I check the log, it shows that the data is processed, but giving error response when trying to send the OPENAI response back via whatsapp to other number.
I think you may need to confirm the number in the Meta developer dashboard as you did for your own. I.e adding it under WhatsApp and then verifying it via WhatsApp.
I see, thanks for the answer!
Is there a guide to getting this on my whatsapp?
Yes see the tutorial. It will help you through it.
Yes we just found out this one is giving auth errors. Engineer is back tomorrow to check it out EU time. Might have been changes to the Meta docs. Will let you know once this is sorted.
Soon chatgpt api will be released so im expecting great things from this
@quiet crane , just a heads up, suddenly the dall-e extension doesn't work. It stuck on the process generate with the message said { error: [Object] }
the davinci one still works on me.
I'll check it out.
I just tried it without issues. Could you send me all your logs?
wait a sec
1/18/2023, 4:51:30 PM INFO Generate { error: [Object] }
1/18/2023, 4:51:30 PM INFO Generate calling OpenAI with: {
prompt: '/dalle a brand new ipad in 3d rendering, highly detailed, white, clear, crisp image, high quality, highly detailed'
}
1/18/2023, 4:51:30 PM INFO Option generate image
eh, wait, i tried another prompt and it shows
weird
but if I input the same prompt, it went error
could you try this prompt @quiet crane ?
/dalle a brand new ipad in 3d rendering, highly detailed, white, clear, crisp image, high quality, highly detailed
Ahh, I found the error. Not sure why they feel like this is a security risk. You can hook on a new function from the error port in the OpenAI function and it will stringify the object so you can see it in the Logs.
ah, I see... perhaps just a kind of bug I think then
thank you for the fast response!
No problem, hope you'll figure it out 👍
yeah, it only went error if I put some prompt, while for other it works
perhaps some prompts somehow triggered a false flag
Yeah, interesting.
We've added support for images in the WhatsApp Send function now so you'll be able to pick it as an operation. Just be aware that you need to send in a link rather than a text. See example attached.
WOAH, niceee
ok, just tried it and it works!! Thanks @quiet crane
@quiet crane does the Lolo App capture any conversation? I am very new to this, so trying to get a grip
Can you elaborate on what you mean by capture?
Say if I make my own bot using the above information, and start chatting with the bot, will that chat be captured?
Do you mean "capture" as in logged by the system?
Or do you mean "capture" as, the bot able to "capture" information you provide in the message and messages before that?
Logged
Say if I ask, Who will be going to Mars first ? Will that conversation be logged
Hmm, not sure entirely what you mean. But yes if you ask it questions it will respond from OpenAI.
AFAIK, lolo server doesn't keep your conversation data (CMIIW). But whether it is saved or not in OpenAI, it is a totally different thing (which is I don't know the answer since I haven't read their ToS fully).
@quiet crane , is there any way to add negative prompts to the dalle input?
If the API supports it, it should work. It's just making an API call to the image endpoint
also, I encountered a lot of these errors:
s Error: Request failed with status code 400
at createError (/usr/src/node_modules/openai/node_modules/axios/lib/core/createError.js:16:15)
at settle (/usr/src/node_modules/openai/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/usr/src/node_modules/openai/node_modules/axios/lib/adapters/http.js:322:11)
at IncomingMessage.emit (events.js:412:35)
at endReadableNT (internal/streams/readable.js:1333:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
config: [Object],
request: [ClientRequest],
response: [Object],
isAxiosError: true,
toJSON: [Function: toJSON]
}
what causes it?
Is there any way to re-prompt the last message when we encounter this error? Code suggestion?
Connect the error port to a new function to see if we can get out the response object. But I think there is a limit on prompt size from OpenAI's side.
We've identified a bit of an issue with longer prompts/and prompts with spaces and special characters in the OpenAI library function. We'll figure it out for the library function after the weekend but until then if you want to create a new function and parse in this code:
`const { Configuration, OpenAIApi } = require("openai");
// The export handler will run every time the event is triggered
exports.handler = async(ev, ctx) => {
const { route, log } = ctx;
// good practice to use variables via ctx.env but this is just a demo
const configuration = new Configuration({
apiKey: 'APIKEYHERE',
});
const openai = new OpenAIApi(configuration);
try {
const response = await openai.createCompletion({
model: "text-davinci-003",
prompt: ev.message + "\n",
temperature: 0.7,
max_tokens: 256,
top_p: 1,
frequency_penalty: 0,
presence_penalty: 0,
});
ev.response = response;
route(ev)
} catch (err) {
log.info(err)
}
};`
Use it instead of the OpenAI Library Function for now and set your settings within the code. Remember to add openai under modules within the app's settings. See if this is a temporary fix.
i am getting this error can someone help me
👋 are all of your request like this? Try to insert the meta token again and make sure there are no white spaces. Also make sure you have the phone number id correctly inserted. We have a discord channel where the engineer that built this one should be able to help you out directly. You should see a link within the console to the left.
why sometimes bot doesn't respond the command so i need to type it twice so he understand/respond the command?
Remove store history prompt in the OpenAI function. Save and run it again.
Dang, I literally got so busy last week I haven't had time to open discord... Thanks for the heads up, gonna try it in several days since job is still piling up.
dannggg nice project right here
.
it's work, but sometimes i need "human-like conversation" feature. is there any solution instead of disable history?
oh another question, is it possible to change profile picture instead of blank profile pict?
That's something on Meta's side but I think with a test number it's hard to change the picture. However, if you buy a bot number via Facebook developer you should be able to configure it.
As for the history, checking solutions so hopefully we'll be able to improve that one. But if the ChatGPT API releases soon then that will be a better solution to use in Lolo entirely. But unsure when and if that happens.
Found the issue. It's the max_tokens value. Decrease it and see if that fixes the 400 errors. Play around with this value until you get what you want.
Yosa, try to use the Store Prompt History with a lower max_tokens value as well, see if that fixes those errors as well.
So many updates and I have still no time to check D:
well, no thanks :D
oh let me work with it , thanks!
btw, just want to gave this post with a bump since this still runs pretty good 👍
Hi
@quiet crane is there any way we can user our own number instead of Meta Test?
Also, how to implement the gpt 3.5 turbo api? When I change from text-davinci-003 to turbo 3.5, the input returns error
okay, so after looking here and there, it seems like we need to update the endpoints to https://api.openai.com/v1/chat/completions , but tbh I don't understand where to put it
hopefully @quiet crane can help 👍
An architectural design for a smart, sustainable, vertical, carbon-free city that has renewable energy resources and encourages people to walk, exercise, and use electric cars in it instead of fuel cars, and it contains large green spaces
Meta disabled my business account
as I dont have any business....
any ideas how to keep it going?
how create twilio api key
I don't think we use twilio here?
Hi
hello as well @little saffron
really waiting for @quiet crane to help out fixing openai's GPT 3.5 turbo end point
@tropic iris nice!
is this unlimited or no? I'm actually using this loloco because I do quite a lot of text prompting
Oh, turns out the max_token set is quite low. understandable though due to the nature of this free app
thanks a lot though
Wouldn't you get banned on wsp?
Been using that since quite a long time, no issue at all
Do you use proper API key?
Hey @hollow igloo are you running into the limit? The max_token is set to 1200...
Yes this is using official paid keys on both WhatsApp and OpenAI, so it should not get banned hopefully.
Ahahaha, actually I was asking to @eternal rivet the question xD
Well, to be honest, I'm usually using the max_token to be 4k on my own whatsapp bot since I quite often generate quite long things, such as presentation idea, (full) public speech, etc.
The sad thing is, I don't know how to configure Loloco to make it compatible with gpt 3.5 turbo
@tropic iris how did you manage to keep whatsapp number active, mine got disabled due to needing to do business verification