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

fix: Update Content-Type header to application/x-www-form-urlencoded #5244

Merged
merged 2 commits into from
Mar 4, 2024

Conversation

BiswaViraj
Copy link
Member

What change does this PR introduce?

  • fixed Gupshup provider request format to use form-encoded
  • Gupshup docs

Why was this change needed?

Other information (Screenshots)

Copy link

linear bot commented Feb 29, 2024

Copy link

netlify bot commented Feb 29, 2024

Deploy Preview for dev-web-novu failed.

Name Link
🔨 Latest commit 00c02d8
🔍 Latest deploy log https://app.netlify.com/sites/dev-web-novu/deploys/65e17bc1f10e9300080ff4f1

@BiswaViraj BiswaViraj force-pushed the nv-3544-update-gupshup-provider-payload-request branch from aa415c7 to 1014a11 Compare February 29, 2024 08:42
},
body: JSON.stringify(params),
body: new URLSearchParams(params),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we send the data in the URL according to their documentation? and I'm not sure about the POST method.
Btw the URL should start with https.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var request = require("request");
var options = { method: 'POST',
url: 'https://enterprise.smsgupshup.com/GatewayAPI/rest',
form:
{ method: 'sendMessage',
send_to: '919820XXXXXX',
msg: 'This is sample test message from GupShup',
msg_type: 'TEXT',
userid: 'XXXXXX',auth_scheme: 'PLAIN',
password: 'XXXXX',
format: 'JSON' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
import requests
url = "https://enterprise.smsgupshup.com/GatewayAPI/rest"
payload =
"method=sendMessage&send_to=919820XXXXXX&msg=This%20is%20sample%20test%20message%20from%20
GupShup&msg_type=TEXT&userid=XXXXXX&auth_scheme=PLAIN&password=XXXXX&format=JSON"
response = requests.request("POST", url, data=payload)
print(response.text)

@LetItRock They support both GET and POST method. I took the example from their Node and Python codes.
Should we update it to use GET instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BiswaViraj I was assuming they support both :) all right let's leave it then :)

@BiswaViraj BiswaViraj merged commit 885c9c6 into next Mar 4, 2024
28 of 32 checks passed
@BiswaViraj BiswaViraj deleted the nv-3544-update-gupshup-provider-payload-request branch March 4, 2024 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants