Question: CURL command not executing in SSH

Question

CURL command not executing in SSH

Answers 1
Added at 2016-12-31 22:12
Tags
Question

I am trying to execute a CURL command to set a greeting message for a bot I am building. Guidance from Facebook here: https://developers.facebook.com/docs/messenger-platform/thread-settings/greeting-text

Example from Facebook:

curl -X POST -H "Content-Type: application/json" -d '{
  "setting_type":"greeting",
  "greeting":{
    "text":"Timeless apparel for the masses."
  }
}' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=PAGE_ACCESS_TOKEN" 

I am trying to run that from a SSH command prompt -- the only change I made was make it into 1 line, so that I can execute it from command line in one go.

curl -X POST -H "Content-Type: application/json" -d '{"setting_type":"greeting", "greeting":{"text":"Hi {{user_first_name}}! I am a bot. Simply say 'Hi' to start.. yes, it's as simple as that!"}}' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=EAAFXmrm6M8cBAHF2TwfWMnQfksHnZBtQQIHYWjIFpmTffkG"  

But, I get this error message from SSH when trying to execute above 1 liner.

-bash: !"}}': event not found

What am I doing wrong here? Any help is appreciated.

Answers to

CURL command not executing in SSH

nr: #1 dodano: 2016-12-31 23:12

You have a problem with single quotes ', you can replace them with \u0027 :

curl -X POST -H "Content-Type: application/json" -d '{"setting_type":"greeting", "greeting":{"text":"Hi {{user_first_name}}! I am a bot. Simply say \u0027Hi\u0027 to start.. yes, it\u0027s as simple as that!"}}' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=EAAFXmrm6M8cBAHF2TwfWMnQfksHnZBtQQIHYWjIFpmTffkG"  
Source Show
◀ Wstecz