#Set emotes through API?
1 messages · Page 1 of 1 (latest)
7TV Developer Portal.
@unique moon maybe you can answer better than me
ok thanks a lot ^^ <33 ill wait

hmm, good question, I'm not sure myself there. @hearty valve can you maybe help here?
lmao
ok ok thanks :33 <33
i know an app that can do what im asking, to add an emote through code, so i thought of doing it myself using the API thats why im here
You can do that via GQL api, just open the 7tv website with network tab open, try adding an emote and see how the request works
But I think it'll stop working once the new website drops
@near cedar here
do this
you can use postman to try GQL queries pretty easily
not for api stuff 
yee im a bit lost here
i guess the url for the post is "https://7tv.io/v3/gql" with no header i supose but in the json i dont get what i have to put there
im using a weird app for streamers and those kind of things and im only allowed to use this
so with a header and a body json can i achive all that?
The json I think would be ```js
{
query: ``,
variables: {}
}
okay
and inside variables is where i add the emote set id and the emote id i want to add to it?
or
im sorry im a bit noob within this kind of things
The variables afaik are: ```js
{
action: "ADD",
id: "emotesetid"
emote_id: "emoteid"
}
You have to check how it looks jn the network tab
Kinda hard for me on the phone
so smth like this ´´´{
query: ``,
variables: {
"action": "ADD",
"id": "6113d5e830aa244e81ea8abf",
"emote_id": "66ec4648daf243ce8c786de0"
}
}´´´
oh
and in query
emoteSet(id: $id) {
id
emotes(id: $emote_id, action: $action, name: $name) {
id
name
__typename
}
__typename
}
}``` this is what network did
so i put all that inside the ``
Yes
let me try
thanks a lot for the help btw
thats what im getting
query: `mutationChangeEmoteInSet($id: ObjectID!,
$action: ListItemAction!,
$emote_id: ObjectID!,
$name: String){
emoteSet(id: $id){
idemotes(id: $emote_id,
action: $action,
name: $name){
idname__typename
}__typename
}
}`,
variables: {
"action": "ADD",
"id": "6113d5e830aa244e81ea8abf",
"emote_id": "66ec4648daf243ce8c786de0"
}
}````and this is the json i put

lmao
welp i guess i might have to give up with the idea of adding emotes its a bit too dificult for me maybe, thanks a lot tho ^^<3
Maybe someone else will help you
I think you can't do this in the tool you're using 
ye maybe
im able to get the emotes inside emote-set to track what emotes are beeing used and so
but thats an endpoint to the api so not the same
hopefully in the future a new set-emote endpoint is added
I think with the v4 api (soon™) you'll be able to do these stuff with rest api
ok ok :333 then ill wait to the v4

missing a space, should be mutation ChangeEmoteInSet(...) not mutationChangeEmoteInSet
const body = {
operationName: 'ChangeEmoteInSet',
query: `mutation ChangeEmoteInSet($id: ObjectID!, $action: ListItemAction!, $emote_id: ObjectID!, $name: String) {
emoteSet(id: $id) {
id
emotes(id: $emote_id, action: $action, name: $name) {
id
name
}
}
}`,
variables: {
action: 'ADD',
id: setID,
emote_id: emoteID,
name
}
};
const result = await fetch('https://7tv.io/v3/gql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${'your token'}`
},
body: JSON.stringify(body)
}).then((res) => res.json());
heres a full example
I don't think wrong query is raising this error 
yes, you need that and authorization header
how do i know what to put in there
also, is this good as a json for the kittyJam emote as an example?
do i need to replace "name" in variables¿
if you want to set an alias, yes
otherwise, no
if you open network tab on 7tv.app and find any gql request while signed in, just copy the Authorization and Content-Type headers from there
oh so name is the alias i get it
uhhmm there is a lot here
scroll down to Request Headers
and it will be Authorization: ey........
bearer and a lot of characters
yes
all that including bearer in header

im using a weird app for streamers to do this xjklñd
yeah i dont know if its possible
should work
yee but
what do i put as a name for the object i need to create
and whats inside that object
its a bit hard i guess
let me send what u sended to me to the devs of the app
could you
if its not to much
give me the full header + json
wait let me try
can't you set header Authorization with value Bearer ...? 
'Content-Type': 'application/json',
Authorization: 'Bearer ...'
}```
that is an object
ouh
sorry im a bit noob
let me try doing that inside this
content type is a value of the object?
inside of it i mean
yes
as weel as authorization
thats the name of another value
ok let me try
thats what i can make
an object with two variables
but same thing transport not supported
aaaaahmm
im not familiar with whatever this program is but if its asking for an object it probably wants this format
"Content-Type": "application/json",
"Authorization": "Bearer ..."
}```
idk ive put it as a variable but mabe it isnt what it asked for
for the headers
ye thats what i send
those photos
are the name of the object in purple
and both variables that the object has
both strings
letme try one more thing
well it didn't send the headers, so it is not correct
i dont know
that sets the same object
but wrote it in json format
but same thing
what program/website is this
AAA
WAIT
eeeh sorry
Sammi
new result
was application not aplication lmao
rusty english
the body needs to be a string
wdym
without the {}¿
it is supposed to be a string
all orange-like variables are strings
ok but the header is working thats good news
it would look like this
'{"operationName":"ChangeEmoteInSet","query":"mutation ChangeEmoteInSet($id: ObjectID!, $action: ListItemAction!, $emote_id: ObjectID!, $name: String) { emoteSet(id: $id) { id emotes(id: $emote_id, action: $action, name: $name) { id name } } }","variables":{"action":"ADD","id":"","emote_id":"","name":""}}'
let me try
thats what i get using what u send
sammi asks for "Body JSON string to send"
so i guess what i had is better in this case? i dont really know
It probably pasted with \ to escape ", remove these slashes
yea
Arent there ' at the start and end? Cant see on the phone
Progress 
ñlsfkfdd im so sorry but thanks for your time

you copy pasted my example
you need to provide the values of the set ID and emote ID
you have it backwards
xd


im so fucking happy rn
u both are
like
angels
to me rn
big virtual hug for u both aaaa

this broke recently, was it the api changes u mentioned¿ is the new one gonna be up soon¿
the gql should still work, what's the issue?
Peobably that's the reason #news message
does anyone know where to get the variable to the color of a 7tv user? Like the text color. For example mine is pruple cause im verified. And green for Moderators etc. Does anyone know where to get that throigh the API?
it's defined by this
and you can get normal rgb from that with ```javascript
const DecimalToStringRGB = (num) => {
const r = (num >>> 24) & 0xff;
const g = (num >>> 16) & 0xff;
const b = (num >>> 8) & 0xff;
return `rgb(${r}, ${g}, ${b})`;
};```
it's in most gql requests reffering to the user
Wanna look into it more, but is that the only thing i will need?
I’m kinda new to all this coding so i dont reallly know what to do with the things you sent here. But i guess i can take these and check on claude or chatgpt
If that is all i Will need
You can also get style via rest api, for example https://7tv.io/v3/users/01F7GYP4QG0002T1K3DGA3HTW4, or https://7tv.io/v3/users/TWITCH/198740595
mb, thought only gql returns it
Uhhh now i am a lil confused 
If you want to use gql tho, you can go to 7tv.app and look how the requests look in the network tab
you can use the rest api I gave you, or the gql to find the user style and get the color from there
and this code snippet will let you format it from this "number" to a normal rgb
it worked!



