{"_id":"5638e1e93539050d00082059","hidden":false,"order":0,"parentDoc":null,"title":"Overview","version":"5634abe66d460f0d00612652","__v":10,"githubsync":"","isReference":false,"link_external":false,"body":"Our API may be used to programmatically integrate with our referral system. All API requests require a username and key to be defined, therefore you must have a company account with us before being able to successfully make requests.\n\nIf you have any questions regarding our API, please refer to our [Support Portal](http://support.getambassador.com).\n\nBefore you begin testing the API, please note the following items:\n\n- You cannot mix test and production data (i.e. a commission will not be triggered if a production ambassador is attempting to refer someone to a test campaign)\n- Unless recurring commissions are enabled, ambassadors in the system cannot be referred again\n- Ambassadors already in the system cannot be referred via the API or integration snippet at a later date to prevent \"referral hijacking\" of existing ambassadors/customers.\n- Transaction IDs must be unique for each [/event/record/](doc:eventrecord) call for given campaign. Different campaigns can share the same transaction ID. If a transaction ID exists for given campaign then the call will be rejected.","excerpt":"","link_url":"","slug":"overview","project":"5634abe66d460f0d0061264f","sync_unique":"","type":"basic","updates":["58e65cd3973a492500d7645e"],"api":{"params":[],"results":{"codes":[{"code":"{}","name":"","status":200,"language":"json"},{"name":"","status":400,"language":"json","code":"{}"}]},"settings":"","url":"","auth":"required"},"category":"5634abe76d460f0d00612653","createdAt":"2015-11-03T16:33:45.783Z","user":"5634abcb8b86331700b48916","childrenPages":[]}

Overview


Our API may be used to programmatically integrate with our referral system. All API requests require a username and key to be defined, therefore you must have a company account with us before being able to successfully make requests. If you have any questions regarding our API, please refer to our [Support Portal](http://support.getambassador.com). Before you begin testing the API, please note the following items: - You cannot mix test and production data (i.e. a commission will not be triggered if a production ambassador is attempting to refer someone to a test campaign) - Unless recurring commissions are enabled, ambassadors in the system cannot be referred again - Ambassadors already in the system cannot be referred via the API or integration snippet at a later date to prevent "referral hijacking" of existing ambassadors/customers. - Transaction IDs must be unique for each [/event/record/](doc:eventrecord) call for given campaign. Different campaigns can share the same transaction ID. If a transaction ID exists for given campaign then the call will be rejected.
Our API may be used to programmatically integrate with our referral system. All API requests require a username and key to be defined, therefore you must have a company account with us before being able to successfully make requests. If you have any questions regarding our API, please refer to our [Support Portal](http://support.getambassador.com). Before you begin testing the API, please note the following items: - You cannot mix test and production data (i.e. a commission will not be triggered if a production ambassador is attempting to refer someone to a test campaign) - Unless recurring commissions are enabled, ambassadors in the system cannot be referred again - Ambassadors already in the system cannot be referred via the API or integration snippet at a later date to prevent "referral hijacking" of existing ambassadors/customers. - Transaction IDs must be unique for each [/event/record/](doc:eventrecord) call for given campaign. Different campaigns can share the same transaction ID. If a transaction ID exists for given campaign then the call will be rejected.
{"_id":"5646511b054d8f0d00bc76ac","api":{"auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":""},"body":"Each ambassador created will have share links automatically generated for them using shortcodes. Ambassadors will have a unique share link for each of your company's campaigns which they have access to (this can be limited through the use of private campaigns and groups). Each share link will redirect to their respective landing page, as designated by your campaign's settings.\n\nOur share links behave in the following manner:\n\n- SEO-friendly 301 redirects to your landing page\n- Redirects with the `mbsy` query string variable (the referrer's shortcode)\n- Redirects with the `campaignid` query string variable (the share link's associated campaign ID)\n- Redirects with the `discount_value` query string variable (if the respective campaign has a discount code configured)\n- Tracks click data to be displayed in your company's dashboard\n- Production links use the following URL schema: `mbsy.co/CODE`\n- Test links use the following URL schema: `mbsy.co/sndbx/CODE`\n- Force an alternate redirect using the `url` query string variable with an encoded URL e.g. https://mbsy.co/bFVj?url=http%3A%2F%2Fgoogle.com%3Fsource%3Dambassador%26analytics%3D1234\n- \nHere's a link from one of our own ambassadors so you can observe a normal redirect: https://mbsy.co/bFVj.\n\nEach ambassador also has a memorable share link (provided they have access to at least 1 campaign). Memorable share links use usernames to provide an easy-to-remember share link. In the event that an ambassador has not yet chosen a username, an ID will work as an alternative.\n\nMemorable share links use the following schema:\n\n- https://mbsy.co/company_username/ambassador_username (when a username is available)\n- https://mbsy.co/company_username/ambassador_id (when a username is not available)\n\nFor example, Jeff Epstein has the username \"jeff\". If he did not have a username set, you could see his ID number (44) in the URL of his profile, accessible from the company's list of ambassadors. His memorable share link can be accessed via:\n\n- https://mbsy.co/ambassador/jeff\n*or*\n- https://mbsy.co/ambassador/44\n\nMemorable share links will track click data for and redirect to the longest-running campaign with the farthest end date for which the ambassador has access.","link_url":"","title":"Share Links","updates":[],"user":"5634abcb8b86331700b48916","__v":2,"category":"5634abe76d460f0d00612653","createdAt":"2015-11-13T21:07:39.097Z","githubsync":"","hidden":false,"type":"basic","parentDoc":null,"project":"5634abe66d460f0d0061264f","slug":"share-links","version":"5634abe66d460f0d00612652","excerpt":"","link_external":false,"order":1,"sync_unique":"","isReference":false,"childrenPages":[]}

Share Links


Each ambassador created will have share links automatically generated for them using shortcodes. Ambassadors will have a unique share link for each of your company's campaigns which they have access to (this can be limited through the use of private campaigns and groups). Each share link will redirect to their respective landing page, as designated by your campaign's settings. Our share links behave in the following manner: - SEO-friendly 301 redirects to your landing page - Redirects with the `mbsy` query string variable (the referrer's shortcode) - Redirects with the `campaignid` query string variable (the share link's associated campaign ID) - Redirects with the `discount_value` query string variable (if the respective campaign has a discount code configured) - Tracks click data to be displayed in your company's dashboard - Production links use the following URL schema: `mbsy.co/CODE` - Test links use the following URL schema: `mbsy.co/sndbx/CODE` - Force an alternate redirect using the `url` query string variable with an encoded URL e.g. https://mbsy.co/bFVj?url=http%3A%2F%2Fgoogle.com%3Fsource%3Dambassador%26analytics%3D1234 - Here's a link from one of our own ambassadors so you can observe a normal redirect: https://mbsy.co/bFVj. Each ambassador also has a memorable share link (provided they have access to at least 1 campaign). Memorable share links use usernames to provide an easy-to-remember share link. In the event that an ambassador has not yet chosen a username, an ID will work as an alternative. Memorable share links use the following schema: - https://mbsy.co/company_username/ambassador_username (when a username is available) - https://mbsy.co/company_username/ambassador_id (when a username is not available) For example, Jeff Epstein has the username "jeff". If he did not have a username set, you could see his ID number (44) in the URL of his profile, accessible from the company's list of ambassadors. His memorable share link can be accessed via: - https://mbsy.co/ambassador/jeff *or* - https://mbsy.co/ambassador/44 Memorable share links will track click data for and redirect to the longest-running campaign with the farthest end date for which the ambassador has access.
Each ambassador created will have share links automatically generated for them using shortcodes. Ambassadors will have a unique share link for each of your company's campaigns which they have access to (this can be limited through the use of private campaigns and groups). Each share link will redirect to their respective landing page, as designated by your campaign's settings. Our share links behave in the following manner: - SEO-friendly 301 redirects to your landing page - Redirects with the `mbsy` query string variable (the referrer's shortcode) - Redirects with the `campaignid` query string variable (the share link's associated campaign ID) - Redirects with the `discount_value` query string variable (if the respective campaign has a discount code configured) - Tracks click data to be displayed in your company's dashboard - Production links use the following URL schema: `mbsy.co/CODE` - Test links use the following URL schema: `mbsy.co/sndbx/CODE` - Force an alternate redirect using the `url` query string variable with an encoded URL e.g. https://mbsy.co/bFVj?url=http%3A%2F%2Fgoogle.com%3Fsource%3Dambassador%26analytics%3D1234 - Here's a link from one of our own ambassadors so you can observe a normal redirect: https://mbsy.co/bFVj. Each ambassador also has a memorable share link (provided they have access to at least 1 campaign). Memorable share links use usernames to provide an easy-to-remember share link. In the event that an ambassador has not yet chosen a username, an ID will work as an alternative. Memorable share links use the following schema: - https://mbsy.co/company_username/ambassador_username (when a username is available) - https://mbsy.co/company_username/ambassador_id (when a username is not available) For example, Jeff Epstein has the username "jeff". If he did not have a username set, you could see his ID number (44) in the URL of his profile, accessible from the company's list of ambassadors. His memorable share link can be accessed via: - https://mbsy.co/ambassador/jeff *or* - https://mbsy.co/ambassador/44 Memorable share links will track click data for and redirect to the longest-running campaign with the farthest end date for which the ambassador has access.
{"_id":"564656e6054d8f0d00bc76b8","parentDoc":null,"project":"5634abe66d460f0d0061264f","sync_unique":"","title":"Authentication","__v":1,"body":"You can authenticate with the Ambassador API using your username and API key. You can find this information on your [account settings page](https://getambassador.com/v3/c/settings/account/). Your API key should never be shared or exposed. We provide an embeddable JavaScript snippet and SDKs for client-side integrations.\n\nCredentials:\n- [[app:username]]\n- [[app:key]]\n\nURL Structure for an API Call:\nhttps://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/event/record\n\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Passing your API token in the request header\",\n  \"body\": \"Alternatively, you can add your API key in the request header.  The requires a change to the URL structure.  For example: \\n\\nThis call:\\n\\nhttps://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/event/record\\n\\nchanges to:\\n\\nhttps://getambassador.com/api/v2/[[app:username]]/token/json/event/record\\n\\nAfter changing the URL structure, you will need to pass your token in the header. Here's an example:\\n\\n`Authorization: Token [[app:key]]`\"\n}\n[/block]","link_url":"","next":{"description":"","pages":[]},"user":"5634abcb8b86331700b48916","link_external":false,"type":"basic","updates":[],"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"name":"","status":400,"language":"json","code":"{}"}]},"settings":"","auth":"required","params":[],"url":""},"excerpt":"","hidden":false,"order":2,"slug":"authentication","version":"5634abe66d460f0d00612652","category":"5634abe76d460f0d00612653","createdAt":"2015-11-13T21:32:22.365Z","githubsync":"","isReference":false,"childrenPages":[]}

Authentication


You can authenticate with the Ambassador API using your username and API key. You can find this information on your [account settings page](https://getambassador.com/v3/c/settings/account/). Your API key should never be shared or exposed. We provide an embeddable JavaScript snippet and SDKs for client-side integrations. Credentials: - [[app:username]] - [[app:key]] URL Structure for an API Call: https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/event/record [block:callout] { "type": "info", "title": "Passing your API token in the request header", "body": "Alternatively, you can add your API key in the request header. The requires a change to the URL structure. For example: \n\nThis call:\n\nhttps://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/event/record\n\nchanges to:\n\nhttps://getambassador.com/api/v2/[[app:username]]/token/json/event/record\n\nAfter changing the URL structure, you will need to pass your token in the header. Here's an example:\n\n`Authorization: Token [[app:key]]`" } [/block]
You can authenticate with the Ambassador API using your username and API key. You can find this information on your [account settings page](https://getambassador.com/v3/c/settings/account/). Your API key should never be shared or exposed. We provide an embeddable JavaScript snippet and SDKs for client-side integrations. Credentials: - [[app:username]] - [[app:key]] URL Structure for an API Call: https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/event/record [block:callout] { "type": "info", "title": "Passing your API token in the request header", "body": "Alternatively, you can add your API key in the request header. The requires a change to the URL structure. For example: \n\nThis call:\n\nhttps://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/event/record\n\nchanges to:\n\nhttps://getambassador.com/api/v2/[[app:username]]/token/json/event/record\n\nAfter changing the URL structure, you will need to pass your token in the header. Here's an example:\n\n`Authorization: Token [[app:key]]`" } [/block]
{"_id":"5646555d36961e0d005c61aa","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"name":"","status":400,"language":"json","code":"{}"}]},"settings":"","url":"","auth":"required","params":[]},"category":"5634abe76d460f0d00612653","createdAt":"2015-11-13T21:25:49.713Z","parentDoc":null,"sync_unique":"","githubsync":"","project":"5634abe66d460f0d0061264f","type":"basic","slug":"response-codes","body":"Every API response contains the response code and response details respective to the result of the request. Within this response will be a `data` node which contains the request-specific response.\n\nThe following response codes are used by the API:\n- `200 OK`: The request was successful. See response body for additional data.\n- `400 BAD REQUEST`: The parameters provided were invalid. See response body for error messages.\n- `401 UNAUTHORIZED`: The account name and API key are not valid credentials or an improper request was made.\n- `404 NOT FOUND`: The call you are trying to make does not exist. Check call structure.\n- `500 SERVER ERROR`: Our bad. Try sending your request again and contact us if the problem persists.\n\nTo receive a JSON response, use `json` in your request URLs e.g. https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/event/record.\n\nTo receive XML use `xml` e.g. https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/xml/event/record.\n\nExample responses of our API methods are given for various response formats. Feel free to test more using the API explorer in each method!\n\n**Example Response:** \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<response>\\n  <code>200</code>\\n  <message>OK: The request was successful. See response body for additional data.</message>\\n  <data>\\n    <ambassadors>\\n      <ambassador>\\n        <first_name>Jane</first_name>\\n        <last_name>Doe</last_name>\\n        <email>jane@example.com</email>\\n        <uid>142</uid>\\n        <balance_money>0.00</balance_money>\\n        <balance_points>0</balance_points>\\n        <memorable_url>http://mbsy.co/Developers/djane</memorable_url>\\n        <unique_referrals>0</unique_referrals>\\n        <sandbox>0</sandbox>\\n      </ambassador>\\n      <ambassador>\\n        <first_name>John</first_name>\\n        <last_name>Doe</last_name>\\n        <email>john@example.com</email>\\n        <uid>143</uid>\\n        <balance_money>0.00</balance_money>\\n        <balance_points>0</balance_points>\\n        <memorable_url>http://mbsy.co/Developers/djohn</memorable_url>\\n        <unique_referrals>0</unique_referrals>\\n        <sandbox>0</sandbox>\\n      </ambassador>\\n      <ambassador>\\n        <first_name>Bob</first_name>\\n        <last_name>Doe</last_name>\\n        <email>bob@example.com</email>\\n        <uid>144</uid>\\n        <balance_money>0.00</balance_money>\\n        <balance_points>0</balance_points>\\n        <memorable_url>http://mbsy.co/Developers/dbob</memorable_url>\\n        <unique_referrals>0</unique_referrals>\\n        <sandbox>0</sandbox>\\n      </ambassador>\\n    </ambassadors>\\n  </data>\\n</response>\",\n      \"language\": \"json\",\n      \"name\": \"XML\"\n    },\n    {\n      \"code\": \"{\\n  \\\"response\\\": {\\n    \\\"code\\\": \\\"200\\\",\\n    \\\"message\\\": \\\"OK: The request was successful. See response body for additional data.\\\",\\n    \\\"data\\\": {\\n      \\\"ambassadors\\\": [\\n        {\\n          \\\"first_name\\\": \\\"Jane\\\",\\n          \\\"last_name\\\": \\\"Doe\\\",\\n          \\\"email\\\": \\\"jane@example.com\\\",\\n          \\\"uid\\\": \\\"142\\\",\\n          \\\"balance_money\\\": \\\"0.00\\\",\\n          \\\"balance_points\\\": \\\"0\\\",\\n          \\\"memorable_url\\\": \\\"http://mbsy.co/Developers/djane\\\",\\n          \\\"unique_referrals\\\": \\\"0\\\",\\n          \\\"sandbox\\\": \\\"0\\\"\\n        },\\n        {\\n          \\\"first_name\\\": \\\"John\\\",\\n          \\\"last_name\\\": \\\"Doe\\\",\\n          \\\"email\\\": \\\"john@example.com\\\",\\n          \\\"uid\\\": \\\"143\\\",\\n          \\\"balance_money\\\": \\\"0.00\\\",\\n          \\\"balance_points\\\": \\\"0\\\",\\n          \\\"memorable_url\\\": \\\"http://mbsy.co/Developers/djohn\\\",\\n          \\\"unique_referrals\\\": \\\"0\\\",\\n          \\\"sandbox\\\": \\\"0\\\"\\n        },\\n        {\\n          \\\"first_name\\\": \\\"Bob\\\",\\n          \\\"last_name\\\": \\\"Doe\\\",\\n          \\\"email\\\": \\\"bob@example.com\\\",\\n          \\\"uid\\\": \\\"144\\\",\\n          \\\"balance_money\\\": \\\"0.00\\\",\\n          \\\"balance_points\\\": \\\"0\\\",\\n          \\\"memorable_url\\\": \\\"http://mbsy.co/Developers/dbob\\\",\\n          \\\"unique_referrals\\\": \\\"0\\\",\\n          \\\"sandbox\\\": \\\"0\\\"\\n        }\\n      ]\\n    }\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ]\n}\n[/block]\n**Example Error Response:** \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<response>\\n  <code>400</code>\\n  <message>BAD REQUEST: The parameters provided were invalid. See response body for error messages.</message>\\n  <data>\\n    <error>The following POST parameters are required. \\\"campaign_uid\\\" and \\\"email\\\".</error>\\n  </data>\\n</response>\",\n      \"language\": \"xml\"\n    },\n    {\n      \"code\": \"{\\n  \\\"response\\\": {\\n    \\\"code\\\": \\\"400\\\",\\n    \\\"message\\\": \\\"BAD REQUEST: The parameters provided were invalid. See response body for error messages.\\\",\\n    \\\"errors\\\": {\\n      \\\"error\\\": [\\n        \\\"The following POST parameters are required. \\\\\\\"campaign_uid\\\\\\\" and \\\\\\\"email\\\\\\\".\\\"\\n      ]\\n    }\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"","hidden":false,"link_url":"","next":{"pages":[],"description":""},"order":3,"user":"5634abcb8b86331700b48916","version":"5634abe66d460f0d00612652","__v":4,"isReference":false,"link_external":false,"title":"Response Format","updates":[],"childrenPages":[]}

Response Format


Every API response contains the response code and response details respective to the result of the request. Within this response will be a `data` node which contains the request-specific response. The following response codes are used by the API: - `200 OK`: The request was successful. See response body for additional data. - `400 BAD REQUEST`: The parameters provided were invalid. See response body for error messages. - `401 UNAUTHORIZED`: The account name and API key are not valid credentials or an improper request was made. - `404 NOT FOUND`: The call you are trying to make does not exist. Check call structure. - `500 SERVER ERROR`: Our bad. Try sending your request again and contact us if the problem persists. To receive a JSON response, use `json` in your request URLs e.g. https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/event/record. To receive XML use `xml` e.g. https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/xml/event/record. Example responses of our API methods are given for various response formats. Feel free to test more using the API explorer in each method! **Example Response:** [block:code] { "codes": [ { "code": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<response>\n <code>200</code>\n <message>OK: The request was successful. See response body for additional data.</message>\n <data>\n <ambassadors>\n <ambassador>\n <first_name>Jane</first_name>\n <last_name>Doe</last_name>\n <email>jane@example.com</email>\n <uid>142</uid>\n <balance_money>0.00</balance_money>\n <balance_points>0</balance_points>\n <memorable_url>http://mbsy.co/Developers/djane</memorable_url>\n <unique_referrals>0</unique_referrals>\n <sandbox>0</sandbox>\n </ambassador>\n <ambassador>\n <first_name>John</first_name>\n <last_name>Doe</last_name>\n <email>john@example.com</email>\n <uid>143</uid>\n <balance_money>0.00</balance_money>\n <balance_points>0</balance_points>\n <memorable_url>http://mbsy.co/Developers/djohn</memorable_url>\n <unique_referrals>0</unique_referrals>\n <sandbox>0</sandbox>\n </ambassador>\n <ambassador>\n <first_name>Bob</first_name>\n <last_name>Doe</last_name>\n <email>bob@example.com</email>\n <uid>144</uid>\n <balance_money>0.00</balance_money>\n <balance_points>0</balance_points>\n <memorable_url>http://mbsy.co/Developers/dbob</memorable_url>\n <unique_referrals>0</unique_referrals>\n <sandbox>0</sandbox>\n </ambassador>\n </ambassadors>\n </data>\n</response>", "language": "json", "name": "XML" }, { "code": "{\n \"response\": {\n \"code\": \"200\",\n \"message\": \"OK: The request was successful. See response body for additional data.\",\n \"data\": {\n \"ambassadors\": [\n {\n \"first_name\": \"Jane\",\n \"last_name\": \"Doe\",\n \"email\": \"jane@example.com\",\n \"uid\": \"142\",\n \"balance_money\": \"0.00\",\n \"balance_points\": \"0\",\n \"memorable_url\": \"http://mbsy.co/Developers/djane\",\n \"unique_referrals\": \"0\",\n \"sandbox\": \"0\"\n },\n {\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"email\": \"john@example.com\",\n \"uid\": \"143\",\n \"balance_money\": \"0.00\",\n \"balance_points\": \"0\",\n \"memorable_url\": \"http://mbsy.co/Developers/djohn\",\n \"unique_referrals\": \"0\",\n \"sandbox\": \"0\"\n },\n {\n \"first_name\": \"Bob\",\n \"last_name\": \"Doe\",\n \"email\": \"bob@example.com\",\n \"uid\": \"144\",\n \"balance_money\": \"0.00\",\n \"balance_points\": \"0\",\n \"memorable_url\": \"http://mbsy.co/Developers/dbob\",\n \"unique_referrals\": \"0\",\n \"sandbox\": \"0\"\n }\n ]\n }\n }\n}", "language": "json", "name": "JSON" } ] } [/block] **Example Error Response:** [block:code] { "codes": [ { "code": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<response>\n <code>400</code>\n <message>BAD REQUEST: The parameters provided were invalid. See response body for error messages.</message>\n <data>\n <error>The following POST parameters are required. \"campaign_uid\" and \"email\".</error>\n </data>\n</response>", "language": "xml" }, { "code": "{\n \"response\": {\n \"code\": \"400\",\n \"message\": \"BAD REQUEST: The parameters provided were invalid. See response body for error messages.\",\n \"errors\": {\n \"error\": [\n \"The following POST parameters are required. \\\"campaign_uid\\\" and \\\"email\\\".\"\n ]\n }\n }\n}", "language": "json" } ] } [/block]
Every API response contains the response code and response details respective to the result of the request. Within this response will be a `data` node which contains the request-specific response. The following response codes are used by the API: - `200 OK`: The request was successful. See response body for additional data. - `400 BAD REQUEST`: The parameters provided were invalid. See response body for error messages. - `401 UNAUTHORIZED`: The account name and API key are not valid credentials or an improper request was made. - `404 NOT FOUND`: The call you are trying to make does not exist. Check call structure. - `500 SERVER ERROR`: Our bad. Try sending your request again and contact us if the problem persists. To receive a JSON response, use `json` in your request URLs e.g. https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/event/record. To receive XML use `xml` e.g. https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/xml/event/record. Example responses of our API methods are given for various response formats. Feel free to test more using the API explorer in each method! **Example Response:** [block:code] { "codes": [ { "code": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<response>\n <code>200</code>\n <message>OK: The request was successful. See response body for additional data.</message>\n <data>\n <ambassadors>\n <ambassador>\n <first_name>Jane</first_name>\n <last_name>Doe</last_name>\n <email>jane@example.com</email>\n <uid>142</uid>\n <balance_money>0.00</balance_money>\n <balance_points>0</balance_points>\n <memorable_url>http://mbsy.co/Developers/djane</memorable_url>\n <unique_referrals>0</unique_referrals>\n <sandbox>0</sandbox>\n </ambassador>\n <ambassador>\n <first_name>John</first_name>\n <last_name>Doe</last_name>\n <email>john@example.com</email>\n <uid>143</uid>\n <balance_money>0.00</balance_money>\n <balance_points>0</balance_points>\n <memorable_url>http://mbsy.co/Developers/djohn</memorable_url>\n <unique_referrals>0</unique_referrals>\n <sandbox>0</sandbox>\n </ambassador>\n <ambassador>\n <first_name>Bob</first_name>\n <last_name>Doe</last_name>\n <email>bob@example.com</email>\n <uid>144</uid>\n <balance_money>0.00</balance_money>\n <balance_points>0</balance_points>\n <memorable_url>http://mbsy.co/Developers/dbob</memorable_url>\n <unique_referrals>0</unique_referrals>\n <sandbox>0</sandbox>\n </ambassador>\n </ambassadors>\n </data>\n</response>", "language": "json", "name": "XML" }, { "code": "{\n \"response\": {\n \"code\": \"200\",\n \"message\": \"OK: The request was successful. See response body for additional data.\",\n \"data\": {\n \"ambassadors\": [\n {\n \"first_name\": \"Jane\",\n \"last_name\": \"Doe\",\n \"email\": \"jane@example.com\",\n \"uid\": \"142\",\n \"balance_money\": \"0.00\",\n \"balance_points\": \"0\",\n \"memorable_url\": \"http://mbsy.co/Developers/djane\",\n \"unique_referrals\": \"0\",\n \"sandbox\": \"0\"\n },\n {\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"email\": \"john@example.com\",\n \"uid\": \"143\",\n \"balance_money\": \"0.00\",\n \"balance_points\": \"0\",\n \"memorable_url\": \"http://mbsy.co/Developers/djohn\",\n \"unique_referrals\": \"0\",\n \"sandbox\": \"0\"\n },\n {\n \"first_name\": \"Bob\",\n \"last_name\": \"Doe\",\n \"email\": \"bob@example.com\",\n \"uid\": \"144\",\n \"balance_money\": \"0.00\",\n \"balance_points\": \"0\",\n \"memorable_url\": \"http://mbsy.co/Developers/dbob\",\n \"unique_referrals\": \"0\",\n \"sandbox\": \"0\"\n }\n ]\n }\n }\n}", "language": "json", "name": "JSON" } ] } [/block] **Example Error Response:** [block:code] { "codes": [ { "code": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<response>\n <code>400</code>\n <message>BAD REQUEST: The parameters provided were invalid. See response body for error messages.</message>\n <data>\n <error>The following POST parameters are required. \"campaign_uid\" and \"email\".</error>\n </data>\n</response>", "language": "xml" }, { "code": "{\n \"response\": {\n \"code\": \"400\",\n \"message\": \"BAD REQUEST: The parameters provided were invalid. See response body for error messages.\",\n \"errors\": {\n \"error\": [\n \"The following POST parameters are required. \\\"campaign_uid\\\" and \\\"email\\\".\"\n ]\n }\n }\n}", "language": "json" } ] } [/block]
{"_id":"56e1c79c92bf640e00b5562d","excerpt":"","project":"5634abe66d460f0d0061264f","slug":"integration","sync_unique":"","order":4,"updates":[],"__v":2,"api":{"auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":""},"createdAt":"2016-03-10T19:14:36.140Z","link_external":false,"category":"5634abe76d460f0d00612653","hidden":false,"title":"Integration","version":"5634abe66d460f0d00612652","type":"basic","user":"56ddedf5502b132000191327","body":"### API-based Integration and Recommendations\nBelow is a typical flow of how to set up a custom incentive program on your website using our API.\n1. Sign up for Ambassador to gain access to the API.\n2. Create a campaign with your custom reward settings.\n3. Create a \"rewards program\" or similar page on your site.\n4. When a user accesses the page, call our ambassador/get API method.\n5. Use the results from the API call to display your customer's unique sharing links.\n6. Call our event/record API method when an event happens for your configured campaign.\n7. Use the results from the API call to reward the referring customer via a method of your choosing, or manage commissions and payouts through our platform.\n8. Get the ball rolling by telling your customers about your new referral program.\n\nImplementation notes:\n* For API-based integrations: On each campaign landing page to your website, check for the \"mbsy\" GET variable and store it in your visitor's session. You'll need it later if they complete a campaign event.","githubsync":"","isReference":false,"link_url":"","parentDoc":null,"childrenPages":[]}

Integration


### API-based Integration and Recommendations Below is a typical flow of how to set up a custom incentive program on your website using our API. 1. Sign up for Ambassador to gain access to the API. 2. Create a campaign with your custom reward settings. 3. Create a "rewards program" or similar page on your site. 4. When a user accesses the page, call our ambassador/get API method. 5. Use the results from the API call to display your customer's unique sharing links. 6. Call our event/record API method when an event happens for your configured campaign. 7. Use the results from the API call to reward the referring customer via a method of your choosing, or manage commissions and payouts through our platform. 8. Get the ball rolling by telling your customers about your new referral program. Implementation notes: * For API-based integrations: On each campaign landing page to your website, check for the "mbsy" GET variable and store it in your visitor's session. You'll need it later if they complete a campaign event.
### API-based Integration and Recommendations Below is a typical flow of how to set up a custom incentive program on your website using our API. 1. Sign up for Ambassador to gain access to the API. 2. Create a campaign with your custom reward settings. 3. Create a "rewards program" or similar page on your site. 4. When a user accesses the page, call our ambassador/get API method. 5. Use the results from the API call to display your customer's unique sharing links. 6. Call our event/record API method when an event happens for your configured campaign. 7. Use the results from the API call to reward the referring customer via a method of your choosing, or manage commissions and payouts through our platform. 8. Get the ball rolling by telling your customers about your new referral program. Implementation notes: * For API-based integrations: On each campaign landing page to your website, check for the "mbsy" GET variable and store it in your visitor's session. You'll need it later if they complete a campaign event.
{"_id":"5963c4c62a2e2600357e06f5","project":"5634abe66d460f0d0061264f","version":"5634abe66d460f0d00612652","category":"5634abe76d460f0d00612653","user":"56ddedf5502b132000191327","updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-07-10T18:17:42.995Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":5,"body":"Ambassador closely monitors usage of its APIs to ensure a quality experience for users of the Ambassador platform. Below, you'll find the limits by which a company can consume the Ambassador API.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Method\",\n    \"h-1\": \"Requests per minute\",\n    \"0-0\": \"ambassador/all\",\n    \"0-1\": \"30\",\n    \"1-0\": \"ambassador/get\",\n    \"1-1\": \"30\",\n    \"2-0\": \"event/record\",\n    \"2-1\": \"30\",\n    \"3-0\": \"company/stats\",\n    \"3-1\": \"10\",\n    \"4-0\": \"ambassador/stats\",\n    \"4-1\": \"10\",\n    \"5-0\": \"All other methods\",\n    \"5-1\": \"60\"\n  },\n  \"cols\": 2,\n  \"rows\": 6\n}\n[/block]\n\n## Tips to minimize API requests\n\nThe tips below are there to help you code defensively and reduce the possibility of being rate limited. \n\n### Batch Processing\n\nIf you need to make a lot of requests, please consider running a batch process that calls the Ambassador API at scheduled intervals or off-peak hours.\n\n### Caching\n\nStore API responses in your application or on your site if you expect a lot of use. For example, don’t try to call the Ambassador API on every page load of your website landing page. Instead, call the API infrequently and load the response into a local cache. When users hit your website load the cached version of the results.\n\n### Webhooks\n\nInstead of polling the Ambassador API to retrieve information, you can be notified via an HTTP request of specific activity in the Ambassador platform.  For more information, please read our [Webhooks documentation](https://docs.getambassador.com/docs/webhooks).","excerpt":"","slug":"rate-limits","type":"basic","title":"Rate Limits","__v":0,"parentDoc":null,"childrenPages":[]}

Rate Limits


Ambassador closely monitors usage of its APIs to ensure a quality experience for users of the Ambassador platform. Below, you'll find the limits by which a company can consume the Ambassador API. [block:parameters] { "data": { "h-0": "Method", "h-1": "Requests per minute", "0-0": "ambassador/all", "0-1": "30", "1-0": "ambassador/get", "1-1": "30", "2-0": "event/record", "2-1": "30", "3-0": "company/stats", "3-1": "10", "4-0": "ambassador/stats", "4-1": "10", "5-0": "All other methods", "5-1": "60" }, "cols": 2, "rows": 6 } [/block] ## Tips to minimize API requests The tips below are there to help you code defensively and reduce the possibility of being rate limited. ### Batch Processing If you need to make a lot of requests, please consider running a batch process that calls the Ambassador API at scheduled intervals or off-peak hours. ### Caching Store API responses in your application or on your site if you expect a lot of use. For example, don’t try to call the Ambassador API on every page load of your website landing page. Instead, call the API infrequently and load the response into a local cache. When users hit your website load the cached version of the results. ### Webhooks Instead of polling the Ambassador API to retrieve information, you can be notified via an HTTP request of specific activity in the Ambassador platform. For more information, please read our [Webhooks documentation](https://docs.getambassador.com/docs/webhooks).
Ambassador closely monitors usage of its APIs to ensure a quality experience for users of the Ambassador platform. Below, you'll find the limits by which a company can consume the Ambassador API. [block:parameters] { "data": { "h-0": "Method", "h-1": "Requests per minute", "0-0": "ambassador/all", "0-1": "30", "1-0": "ambassador/get", "1-1": "30", "2-0": "event/record", "2-1": "30", "3-0": "company/stats", "3-1": "10", "4-0": "ambassador/stats", "4-1": "10", "5-0": "All other methods", "5-1": "60" }, "cols": 2, "rows": 6 } [/block] ## Tips to minimize API requests The tips below are there to help you code defensively and reduce the possibility of being rate limited. ### Batch Processing If you need to make a lot of requests, please consider running a batch process that calls the Ambassador API at scheduled intervals or off-peak hours. ### Caching Store API responses in your application or on your site if you expect a lot of use. For example, don’t try to call the Ambassador API on every page load of your website landing page. Instead, call the API infrequently and load the response into a local cache. When users hit your website load the cached version of the results. ### Webhooks Instead of polling the Ambassador API to retrieve information, you can be notified via an HTTP request of specific activity in the Ambassador platform. For more information, please read our [Webhooks documentation](https://docs.getambassador.com/docs/webhooks).
{"_id":"5638e73a68b11f0d0048c8ff","editedParams2":true,"excerpt":"Records an instance of a campaign referral event.\n\nIf you want to call events for multiple campaigns in one request, use the 'event/multi_record' method.","isReference":true,"order":0,"parentDoc":null,"api":{"examples":{"codes":[{"language":"curl","code":"curl https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/event/record/ \\\n-H \"Content-Type: application/json\" \\\n-d '{\"email\":\"johndoe@example.com\", \"campaign_uid\": 25}' \\\n-X POST","name":""},{"code":"<?php\n    error_reporting(E_ALL);\n    ini_set(\"display_errors\", 1);\n\n    $username = '[[app:username]]';\n    $api_key = '[[app:key]]';\n    $response_type = 'json';\n\n    // Build and make API call\n    $data = array('email' => 'johndoe@example.com',\n                'campaign_uid' => '25');\n    $data = http_build_query($data);\n    $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/event/record/';\n    $curl_handle = curl_init();\n    curl_setopt($curl_handle, CURLOPT_URL, $url);\n    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POST, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);\n    curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n    $response = curl_exec($curl_handle);\n    curl_close($curl_handle);\n\n    echo($response);\n\n    // Example parsing of JSON response\n    if(strtolower($response_type) == 'json')\n    {\n        // Decode response to array\n        $response = json_decode($response, TRUE);\n\n        if(isset($response['response']) && $response['response']['code'] == '200')\n        {\n            // Loop through and output share links\n            if(isset($response['response']['data']['ambassador']['campaign_links']))\n            {\n                foreach($response['response']['data']['ambassador']['campaign_links'] as $ary => $response_row)\n                {\n                    echo \"Campaign Link: \".$response_row['url'].\"\\n\\n\";\n                }\n            }\n        } else {\n            echo 'Error, see response dump above.';\n        }\n    }\n?>","language":"php"},{"language":"python","code":"\"\"\"\nThis example assumes you've installed the popular Requests library\nhttp://docs.python-requests.org\n\"\"\"\nimport json, requests\n\nusername = '[[app:username]]'\napi_key = '[[app:key]]'\nresponse_type = 'json'\nbase_url = 'https://getambassador.com/api/v2/{0}/{1}/{2}'.format(\n    username, api_key, response_type)\n\nemail = 'johndoe@example.com'\nshort_code = 'abc'\ncampaign = 25\n\ndata = {'email': email, 'short_code': short_code, 'campaign_uid': campaign}\nrequest = requests.post(base_url+'/event/record/', data=data)\n\ntry:\n    response = json.loads(request.text)\nexcept (TypeError, ValueError), e:\n    print \"Error: {0}. Response: {1}.\".format(e,request.text)\nelse:\n    response = response.get('response')\n    if response and int(response.get('code',0)) == 200:\n        for campaign in response['data']['ambassador']['campaign_links']:\n            print \"Campaign link: {0}\".format(campaign['url'])\n    else:\n        print request.text"}]},"method":"post","params":[{"default":"","type":"string","name":"email","in":"body","_id":"5638e73a68b11f0d0048c901","ref":"","required":true,"desc":"Your customer's email address"},{"_id":"5638e73a68b11f0d0048c900","ref":"","required":false,"desc":"Your campaign's ID; required if product_id is not used","default":"","type":"int","name":"campaign_uid","in":"body"},{"_id":"5645178c2c74cf1900da48f3","ref":"","required":false,"desc":"Your product id which is assigned to one of your campaigns; can be used instead of campaign_uid; required if campaign_uid is not used","default":"","type":"int","name":"product_id","in":"body"},{"_id":"5645178c2c74cf1900da48f2","ref":"","required":false,"desc":"Referrer's \"mbsy\" shortcode; required for initial commissions","default":"","type":"string","name":"short_code","in":"body"},{"in":"body","_id":"5645178c2c74cf1900da48f1","ref":"","required":false,"desc":"Revenue amount of the event","default":"0","type":"double","name":"revenue"},{"ref":"","required":false,"desc":"Unique transaction ID for the event","default":"","type":"string","name":"transaction_uid","in":"body","_id":"5645178c2c74cf1900da48f0"},{"type":"string","name":"ip_address","in":"body","_id":"5646491936961e0d005c619b","ref":"","required":false,"desc":"Your customer's IP address","default":""},{"type":"string","name":"uid","in":"body","_id":"5646491936961e0d005c619a","ref":"","required":false,"desc":"Your customer's internal unique ID","default":""},{"type":"string","name":"first_name","in":"body","_id":"56464ae5c7687d0d00739e9f","ref":"","required":false,"desc":"Your customer's first name","default":""},{"required":false,"desc":"Your customer's last name","default":"","type":"string","name":"last_name","in":"body","_id":"56464ae5c7687d0d00739e9e","ref":""},{"desc":"Custom field - related to ambassador","default":"","type":"string","name":"custom1","in":"body","_id":"56464ae5c7687d0d00739e9d","ref":"","required":false},{"name":"custom2","in":"body","_id":"56464c86a74cd10d00a3f024","ref":"","required":false,"desc":"Custom field - related to ambassador","default":"","type":"string"},{"default":"","type":"string","name":"custom3","in":"body","_id":"56464c86a74cd10d00a3f023","ref":"","required":false,"desc":"Custom field - related to ambassador"},{"in":"body","_id":"56464c86a74cd10d00a3f022","default":"1","desc":"Email login credentials to new ambassadors (1 - yes, 0 - no)","name":"email_new_ambassador","ref":"","required":false,"type":"string"},{"default":"0","desc":"New ambassadors created are deactivated (1 - yes, 0 - no)","name":"deactivate_new_ambassador","ref":"","required":false,"type":"string","in":"body","_id":"56464c86a74cd10d00a3f021"},{"required":false,"type":"string","in":"body","_id":"56464c86a74cd10d00a3f020","default":"0 (1 if you signed up before Nov 5 2013)","desc":"If the customer is not an ambassador, create them (1 - yes, 0 - no)","name":"auto_create","ref":""},{"desc":"Define which group(s) new ambassadors will be created in. Using this parameter will override default group settings. Group IDs should be separated by commas If add_to_group_id=-1, then ambassador will not be added to any group","in":"body","name":"add_to_group_id","ref":"","required":false,"type":"string","_id":"56464d5c56fb450d00410046","default":""},{"desc":"Custom field - related to the event","default":"","type":"string","name":"event_data1","in":"body","_id":"56464d5c56fb450d00410045","ref":"","required":false},{"name":"event_data2","in":"body","_id":"56464d5c56fb450d00410044","ref":"","required":false,"desc":"Custom field - related to the event","default":"","type":"string"},{"default":"","type":"string","name":"event_data3","in":"body","_id":"56464d5c56fb450d00410043","ref":"","required":false,"desc":"Custom field - related to the event"},{"type":"string","_id":"56464d5c56fb450d00410042","default":"","desc":"Commission status (1 - approved, 0 - pending). Entering a value will override the campaign's auto approve setting.  Otherwise, the campaign's setting will be used if not provided.","in":"body","name":"is_approved","ref":"","required":false},{"ref":"","required":false,"desc":"Your customer's street","default":"","type":"string","name":"street","in":"body","_id":"571e23fa5536c12000f51a9e"},{"required":false,"desc":"Your customer's city","default":"","type":"string","name":"city","in":"body","_id":"571e23fa5536c12000f51a9d","ref":""},{"default":"","type":"string","name":"state","in":"body","_id":"571e23fa5536c12000f51a9c","ref":"","required":false,"desc":"Your customer's state"},{"_id":"571e23fa5536c12000f51a9b","ref":"","required":false,"desc":"Your customer's zip","default":"","type":"string","name":"zip","in":"body"},{"_id":"571e23fa5536c12000f51a9a","ref":"","required":false,"desc":"Your customer's country","default":"","type":"string","name":"country","in":"body"},{"_id":"5734d39d7b9859320047f4b7","ref":"","required":false,"desc":"Your customer's phone number","default":"","type":"string","name":"phone","in":"body"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"response\": {\n    \"code\": \"200\",\n    \"message\": \"OK: The request was successful. See response body for additional data.\",\n    \"data\": {\n      \"referring_ambassador\": {\n        \"first_name\": \"Jane\",\n        \"last_name\": \"Doe\",\n        \"email\": \"jane@example.com\",\n        \"uid\": null,\n        \"commission\": 2,\n        \"balance_money\": 2,\n        \"balance_points\": \"0\",\n        \"memorable_url\": \"http://mbsy.co/USERNAME/djane\",\n        \"unique_referrals\": \"1\",\n        \"sandbox\": \"0\",\n        \"custom1\": null,\n        \"custom2\": null,\n        \"custom3\": null\n      },\n      \"ambassador\": {\n        \"first_name\": \"John\",\n        \"last_name\": \"Doe\",\n        \"email\": \"john@example.com\",\n        \"uid\": null,\n        \"balance_money\": 0,\n        \"balance_points\": 0,\n        \"memorable_url\": \"http://mbsy.co/USERNAME/djohn\",\n        \"unique_referrals\": 0,\n        \"sandbox\": \"0\",\n        \"custom1\": null,\n        \"custom2\": null,\n        \"custom3\": null,\n        \"street\": \"\",\n        \"city\": \"\",\n        \"state\": \"\",\n        \"zip\": \"\",\n        \"country\": \"\",\n        \"phone\": \"\",\n        \"groups\": \"2\",\n        \"campaign_links\": [\n          {\n            \"campaign_uid\": \"25\",\n            \"campaign_name\": \"Refer a Company\",\n            \"sandbox\": \"0\",\n            \"private\": \"0\",\n            \"facebook_enabled\": \"0\",\n            \"campaign_description\": \"Refer a new company to Ambassador and get rewarded 50% of their first payment and 10% of each recurring payment!\",\n            \"url\": \"http:\\/\\/mbsy.co\\/8l\",\n            \"total_money_earned\": \"0\",\n            \"total_points_earned\": \"0\"\n          }\n        ]\n      }\n    }\n  }\n}","name":""},{"status":400,"language":"json","code":"{\n  \"response\": {\n    \"code\": \"400\",\n    \"message\": \"BAD REQUEST: The parameters provided were invalid. See response body for error messages.\",\n    \"errors\": {\n      \"error\": [\n        \"The following POST parameter is required: \\\"email\\\".\"\n      ]\n    }\n  }\n}","name":""}]},"settings":"","url":"/event/record/","auth":"required"},"body":"Note: If you want to call events for multiple campaigns in one request, use the [/event/multi_record/](doc:eventmulti_record) method.","editedParams":true,"project":"5634abe66d460f0d0061264f","title":"/event/record/","type":"post","user":"5634abcb8b86331700b48916","version":"5634abe66d460f0d00612652","category":"56464ea136961e0d005c61a5","link_url":"","slug":"eventrecord","link_external":false,"updates":[],"githubsync":"","hidden":false,"sync_unique":"","__v":7,"createdAt":"2015-11-03T16:56:26.107Z","childrenPages":[]}

post/event/record/

Records an instance of a campaign referral event. If you want to call events for multiple campaigns in one request, use the 'event/multi_record' method.

Body Params

email:
required
string
Your customer's email address
campaign_uid:
integer
Your campaign's ID; required if product_id is not used
product_id:
integer
Your product id which is assigned to one of your campaigns; can be used instead of campaign_uid; required if campaign_uid is not used
short_code:
string
Referrer's "mbsy" shortcode; required for initial commissions
revenue:
double0
Revenue amount of the event
transaction_uid:
string
Unique transaction ID for the event
ip_address:
string
Your customer's IP address
uid:
string
Your customer's internal unique ID
first_name:
string
Your customer's first name
last_name:
string
Your customer's last name
custom1:
string
Custom field - related to ambassador
custom2:
string
Custom field - related to ambassador
custom3:
string
Custom field - related to ambassador
email_new_ambassador:
string1
Email login credentials to new ambassadors (1 - yes, 0 - no)
deactivate_new_ambassador:
string0
New ambassadors created are deactivated (1 - yes, 0 - no)
auto_create:
string0 (1 if you signed up before Nov 5 2013)
If the customer is not an ambassador, create them (1 - yes, 0 - no)
add_to_group_id:
string
Define which group(s) new ambassadors will be created in. Using this parameter will override default group settings. Group IDs should be separated by commas If add_to_group_id=-1, then ambassador will not be added to any group
event_data1:
string
Custom field - related to the event
event_data2:
string
Custom field - related to the event
event_data3:
string
Custom field - related to the event
is_approved:
string
Commission status (1 - approved, 0 - pending). Entering a value will override the campaign's auto approve setting. Otherwise, the campaign's setting will be used if not provided.
street:
string
Your customer's street
city:
string
Your customer's city
state:
string
Your customer's state
zip:
string
Your customer's zip
country:
string
Your customer's country
phone:
string
Your customer's phone number
Note: If you want to call events for multiple campaigns in one request, use the [/event/multi_record/](doc:eventmulti_record) method.

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



Note: If you want to call events for multiple campaigns in one request, use the [/event/multi_record/](doc:eventmulti_record) method.
{"_id":"565321681efe742100ff53ae","sync_unique":"","updates":[],"version":"5634abe66d460f0d00612652","excerpt":"Records an instance of a campaign referral event for multiple campaigns.","link_url":"","editedParams2":true,"isReference":true,"link_external":false,"order":1,"parentDoc":null,"project":"5634abe66d460f0d0061264f","__v":1,"category":"56464ea136961e0d005c61a5","slug":"eventmulti_record-1","title":"/event/multi_record/","body":"","createdAt":"2015-11-23T14:23:36.164Z","editedParams":true,"githubsync":"","type":"post","user":"5634abcb8b86331700b48916","api":{"url":"/event/multi_record/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/event/multi_record/ \\\n-H \"Content-Type: application/json\" \\\n-d '{\"email\":\"johndoe@example.com\", \"campaign_uid\": 25}' \\\n-X POST","name":""},{"code":"<?php\n    error_reporting(E_ALL);\n    ini_set(\"display_errors\", 1);\n\n    $username = '[[app:username]]';\n    $api_key = '[[app:key]]';\n    $response_type = 'json';\n\n    // Build and make API call\n    $data = array('email' => 'johndoe@example.com',\n                'campaign_uid' => '82,333');\n    $data = http_build_query($data);\n    $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/event/multi_record/';\n    $curl_handle = curl_init();\n    curl_setopt($curl_handle, CURLOPT_URL, $url);\n    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POST, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);\n    curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n    $response = curl_exec($curl_handle);\n    curl_close($curl_handle);\n\n    echo($response);\n\n    // Example parsing of JSON response\n    if(strtolower($response_type) == 'json')\n    {\n        // Decode response to array\n        $response = json_decode($response, TRUE);\n\n        if(isset($response['response']) && $response['response']['code'] == '200')\n        {\n            // Loop through and output share links\n            if(isset($response['response']['data']['item']))\n            {\n                foreach($response['response']['data']['item'] as $ary => $response_row)\n                {\n                    echo \"Campaign Data: \".$response_row['data'].\"\\n\\n\";\n                }\n            }\n        } else {\n            echo 'Error, see response dump above.';\n        }\n    }\n?>","language":"php"}]},"method":"post","params":[{"_id":"5638e73a68b11f0d0048c901","ref":"","in":"body","required":true,"desc":"Your customer's email address","default":"","type":"string","name":"email"},{"_id":"5638e73a68b11f0d0048c900","ref":"","in":"body","required":true,"desc":"Your campaigns' IDs (comma-separated)","default":"","type":"string","name":"campaign_uid"},{"_id":"5645178c2c74cf1900da48f2","ref":"","in":"body","required":false,"desc":"Referrer's \"mbsy\" shortcode; required for initial commissions","default":"","type":"string","name":"short_code"},{"_id":"5645178c2c74cf1900da48f1","ref":"","in":"body","required":false,"desc":"Revenue amount of the event","default":"0","type":"double","name":"revenue"},{"_id":"5645178c2c74cf1900da48f0","ref":"","in":"body","required":false,"desc":"Unique transaction ID for the event","default":"","type":"string","name":"transaction_uid"},{"_id":"5646491936961e0d005c619b","ref":"","in":"body","required":false,"desc":"Your customer's IP address","default":"","type":"string","name":"ip_address"},{"_id":"5646491936961e0d005c619a","ref":"","in":"body","required":false,"desc":"Your customer's internal unique ID","default":"","type":"string","name":"uid"},{"_id":"56464ae5c7687d0d00739e9f","ref":"","in":"body","required":false,"desc":"Your customer's first name","default":"","type":"string","name":"first_name"},{"_id":"56464ae5c7687d0d00739e9e","ref":"","in":"body","required":false,"desc":"Your customer's last name","default":"","type":"string","name":"last_name"},{"_id":"56464ae5c7687d0d00739e9d","ref":"","in":"body","required":false,"desc":"Custom field - related to ambassador","default":"","type":"string","name":"custom1"},{"_id":"56464c86a74cd10d00a3f024","ref":"","in":"body","required":false,"desc":"Custom field - related to ambassador","default":"","type":"string","name":"custom2"},{"_id":"56464c86a74cd10d00a3f023","ref":"","in":"body","required":false,"desc":"Custom field - related to ambassador","default":"","type":"string","name":"custom3"},{"_id":"56464c86a74cd10d00a3f022","ref":"","in":"body","required":false,"desc":"Email login credentials to new ambassadors (1 - approved, 0 - pending)","default":"1","type":"string","name":"email_new_ambassador"},{"_id":"56464c86a74cd10d00a3f021","ref":"","in":"body","required":false,"desc":"New ambassadors created are deactivated (1 - approved, 0 - pending)","default":"0","type":"string","name":"deactivate_new_ambassador"},{"_id":"56464c86a74cd10d00a3f020","ref":"","in":"body","required":false,"desc":"If the customer is not an ambassador, create them (1 - approved, 0 - pending)","default":"0","type":"string","name":"auto_create"},{"_id":"56464d5c56fb450d00410046","ref":"","in":"body","required":false,"desc":"Define which group(s) new ambassadors will be created in. Using this parameter will override default group settings. Group IDs should be separated by commas If add_to_group_id=-1, then ambassador will not be added to any group","default":"","type":"string","name":"add_to_group_id"},{"_id":"56464d5c56fb450d00410045","ref":"","in":"body","required":false,"desc":"Custom field - related to the event","default":"","type":"string","name":"event_data1"},{"_id":"56464d5c56fb450d00410044","ref":"","in":"body","required":false,"desc":"Custom field - related to the event","default":"","type":"string","name":"event_data2"},{"_id":"56464d5c56fb450d00410043","ref":"","in":"body","required":false,"desc":"Custom field - related to the event","default":"","type":"string","name":"event_data3"},{"_id":"56464d5c56fb450d00410042","ref":"","in":"body","required":false,"desc":"Commission status (1 - approved, 0 - pending)","default":"campaign setting","type":"string","name":"is_approved"}],"results":{"codes":[{"name":"","code":"{\n  \"response\": {\n    \"code\": \"200\",\n    \"message\": \"OK: The request was successful. See response body for additional data.\",\n    \"data\": {\n      \"item\": {\n        \"campaign_82\": {\n          \"code\": \"200\",\n          \"type\": \"OK\",\n          \"message\": \"OK: The request was successful. See response body for additional data.\",\n          \"data\": {\n            \"referring_ambassador\": {\n              \"first_name\": \"Jane\",\n              \"last_name\": \"Doe\",\n              \"email\": \"jane@example.com\",\n              \"uid\": null,\n              \"commission\": 2,\n              \"balance_money\": 2,\n              \"balance_points\": \"0\",\n              \"memorable_url\": \"http://mbsy.co/Developers/djane\",\n              \"unique_referrals\": \"1\",\n              \"sandbox\": \"0\",\n              \"custom1\": null,\n              \"custom2\": null,\n              \"custom3\": null\n            },\n            \"ambassador\": {\n              \"first_name\": \"John\",\n              \"last_name\": \"Doe\",\n              \"email\": \"john@example.com\",\n              \"uid\": null,\n              \"balance_money\": 0,\n              \"balance_points\": 0,\n              \"memorable_url\": \"http://mbsy.co/Developers/djohn\",\n              \"unique_referrals\": 0,\n              \"sandbox\": \"0\",\n              \"custom1\": null,\n              \"custom2\": null,\n              \"custom3\": null,\n              \"campaign_links\": [\n                {\n                  \"campaign_uid\": \"25\",\n                  \"campaign_name\": \"Refer a Company\",\n                  \"sandbox\": \"0\",\n                  \"private\": \"0\",\n                  \"facebook_enabled\": \"0\",\n                  \"campaign_description\": \"Refer a new company to Ambassador and get rewarded 50% of their first payment and 10% of each recurring payment!\",\n                  \"url\": \"http:\\/\\/mbsy.co\\/8l\",\n                  \"total_money_earned\": \"0\",\n                  \"total_points_earned\": \"0\"\n                }\n              ]\n            },\n            \"company\": {\n              \"company_name\": \"Example Company\",\n              \"company_url\": \"http:\\/\\/example.com\",\n              \"company_email\": \"John@example.com\",\n              \"point_name\": \"Month(s)\",\n              \"outgoing_email\": \"email@example.com\",\n              \"avatar_url\": \"https:\\/\\/s3.amazonaws.com\\/example\\/avatars\\/sample.jpg\"\n           }\n         }\n        },\n        \"campaign_333\": {\n          \"code\": \"200\",\n          \"type\": \"OK\",\n          \"message\": \"OK: The request was successful. See response body for additional data.\",\n          \"data\": {\n            \"referring_ambassador\": {\n              \"first_name\": \"Jane\",\n              \"last_name\": \"Doe\",\n              \"email\": \"jane@example.com\",\n              \"uid\": null,\n              \"commission\": 2,\n              \"balance_money\": 2,\n              \"balance_points\": \"0\",\n              \"memorable_url\": \"http://mbsy.co/Developers/djane\",\n              \"unique_referrals\": \"1\",\n              \"sandbox\": \"0\",\n              \"custom1\": null,\n              \"custom2\": null,\n              \"custom3\": null\n            },\n            \"ambassador\": {\n              \"first_name\": \"John\",\n              \"last_name\": \"Doe\",\n              \"email\": \"john@example.com\",\n              \"uid\": null,\n              \"balance_money\": 0,\n              \"balance_points\": 0,\n              \"memorable_url\": \"http://mbsy.co/Developers/djohn\",\n              \"unique_referrals\": 0,\n              \"sandbox\": \"0\",\n              \"custom1\": null,\n              \"custom2\": null,\n              \"custom3\": null,\n              \"campaign_links\": [\n                {\n                  \"campaign_uid\": \"25\",\n                  \"campaign_name\": \"Refer a Company\",\n                  \"sandbox\": \"0\",\n                  \"private\": \"0\",\n                  \"facebook_enabled\": \"0\",\n                  \"campaign_description\": \"Refer a new company to Ambassador and get rewarded 50% of their first payment and 10% of each recurring payment!\",\n                  \"url\": \"http:\\/\\/mbsy.co\\/8l\",\n                  \"total_money_earned\": \"0\",\n                  \"total_points_earned\": \"0\"\n                }\n              ]\n            },\n            \"company\": {\n              \"company_name\": \"Example Company\",\n              \"company_url\": \"http:\\/\\/example.com\",\n              \"company_email\": \"John@example.com\",\n              \"point_name\": \"Month(s)\",\n              \"outgoing_email\": \"email@example.com\",\n              \"avatar_url\": \"https:\\/\\/s3.amazonaws.com\\/example\\/avatars\\/sample.jpg\"\n            }\n          }\n        }\n      }\n    }\n  }\n}","language":"json","status":200},{"name":"","code":"{\n  \"response\": {\n    \"code\": \"400\",\n    \"message\": \"BAD REQUEST: The parameters provided were invalid. See response body for error messages.\",\n    \"errors\": {\n      \"error\": [\n        \"The following POST parameter is required: \\\"email\\\".\"\n      ]\n    }\n  }\n}","language":"json","status":400},{"status":400,"language":"json","code":"{\n  \"response\": {\n    \"code\": \"200\",\n    \"message\": \"OK: The request was successful. See response body for additional data.\",\n    \"data\": {\n      \"item\": {\n        \"campaign_180\": {\n          \"code\": \"400\",\n          \"message\": \"BAD REQUEST: The parameters provided were invalid. See response body for error messages.\",\n          \"errors\": [\n            \"The provided campaign_uid has expired, doesn't exist, or doesn't belong to your company.\"\n          ],\n          \"type\": \"BAD REQUEST\"\n        },\n        \"campaign_82\": {\n          \"code\": \"200\",\n          \"type\": \"OK\",\n          \"message\": \"OK: The request was successful. See response body for additional data.\",\n          \"data\": {\n            \"referring_ambassador\": {\n              \"first_name\": \"Jane\",\n              \"last_name\": \"Doe\",\n              \"email\": \"jane@example.com\",\n              \"uid\": null,\n              \"commission\": 2,\n              \"balance_money\": 2,\n              \"balance_points\": \"0\",\n              \"memorable_url\": \"http://mbsy.co/Developers/djane\",\n              \"unique_referrals\": \"1\",\n              \"sandbox\": \"0\",\n              \"custom1\": null,\n              \"custom2\": null,\n              \"custom3\": null\n            },\n            \"ambassador\": {\n              \"first_name\": \"John\",\n              \"last_name\": \"Doe\",\n              \"email\": \"john@example.com\",\n              \"uid\": null,\n              \"balance_money\": 0,\n              \"balance_points\": 0,\n              \"memorable_url\": \"http://mbsy.co/Developers/djohn\",\n              \"unique_referrals\": 0,\n              \"sandbox\": \"0\",\n              \"custom1\": null,\n              \"custom2\": null,\n              \"custom3\": null,\n              \"campaign_links\": [\n                {\n                  \"campaign_uid\": \"25\",\n                  \"campaign_name\": \"Refer a Company\",\n                  \"sandbox\": \"0\",\n                  \"private\": \"0\",\n                  \"facebook_enabled\": \"0\",\n                  \"campaign_description\": \"Refer a new company to Ambassador and get rewarded 50% of their first payment and 10% of each recurring payment!\",\n                  \"url\": \"http:\\/\\/mbsy.co\\/8l\",\n                  \"total_money_earned\": \"0\",\n                  \"total_points_earned\": \"0\"\n                }\n              ]\n            },\n            \"company\": {\n              \"company_name\": \"Example Company\",\n              \"company_url\": \"http:\\/\\/example.com\",\n              \"company_email\": \"John@example.com\",\n              \"point_name\": \"Month(s)\",\n              \"outgoing_email\": \"email@example.com\",\n              \"avatar_url\": \"https:\\/\\/s3.amazonaws.com\\/example\\/avatars\\/sample.jpg\"\n            }\n          }\n        }\n      }\n    }\n  }\n}\n"}]},"settings":""},"hidden":false,"next":{"description":"","pages":[]},"childrenPages":[]}

post/event/multi_record/

Records an instance of a campaign referral event for multiple campaigns.

Body Params

email:
required
string
Your customer's email address
campaign_uid:
required
string
Your campaigns' IDs (comma-separated)
short_code:
string
Referrer's "mbsy" shortcode; required for initial commissions
revenue:
double0
Revenue amount of the event
transaction_uid:
string
Unique transaction ID for the event
ip_address:
string
Your customer's IP address
uid:
string
Your customer's internal unique ID
first_name:
string
Your customer's first name
last_name:
string
Your customer's last name
custom1:
string
Custom field - related to ambassador
custom2:
string
Custom field - related to ambassador
custom3:
string
Custom field - related to ambassador
email_new_ambassador:
string1
Email login credentials to new ambassadors (1 - approved, 0 - pending)
deactivate_new_ambassador:
string0
New ambassadors created are deactivated (1 - approved, 0 - pending)
auto_create:
string0
If the customer is not an ambassador, create them (1 - approved, 0 - pending)
add_to_group_id:
string
Define which group(s) new ambassadors will be created in. Using this parameter will override default group settings. Group IDs should be separated by commas If add_to_group_id=-1, then ambassador will not be added to any group
event_data1:
string
Custom field - related to the event
event_data2:
string
Custom field - related to the event
event_data3:
string
Custom field - related to the event
is_approved:
stringcampaign setting
Commission status (1 - approved, 0 - pending)

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"5653214c1efe742100ff53ad","createdAt":"2015-11-23T14:23:08.399Z","isReference":true,"link_url":"","next":{"description":"","pages":[]},"title":"/ambassador/get/","api":{"method":"get","params":[{"required":true,"desc":"Your customer's email address","default":"","type":"string","name":"email","_id":"5638e73a68b11f0d0048c901","ref":"","in":"query"},{"ref":"","in":"query","required":false,"desc":"Your customer's internal unique ID","default":"","type":"string","name":"uid","_id":"5646491936961e0d005c619a"},{"default":"","type":"string","name":"first_name","_id":"56464ae5c7687d0d00739e9f","ref":"","in":"query","required":false,"desc":"Your customer's first name"},{"default":"","type":"string","name":"last_name","_id":"56464ae5c7687d0d00739e9e","ref":"","in":"query","required":false,"desc":"Your customer's last name"},{"in":"query","required":false,"desc":"Custom field - related to ambassador","default":"","type":"string","name":"custom1","_id":"56464ae5c7687d0d00739e9d","ref":""},{"desc":"Custom field - related to ambassador","default":"","type":"string","name":"custom2","_id":"56464c86a74cd10d00a3f024","ref":"","in":"query","required":false},{"_id":"56464c86a74cd10d00a3f023","ref":"","in":"query","required":false,"desc":"Custom field - related to ambassador","default":"","type":"string","name":"custom3"},{"_id":"56464c86a74cd10d00a3f022","ref":"","in":"query","required":false,"desc":"Email login credentials to new ambassadors (1 - yes, 0 - no)","default":"1","type":"string","name":"email_new_ambassador"},{"name":"sandbox","_id":"565394caa135f01700b915ff","ref":"","in":"query","required":false,"desc":"New ambassadors created for testing (1 - yes, 0 - no)","default":"0","type":"string"},{"ref":"","in":"query","required":false,"desc":"New ambassadors created are deactivated (1 - yes, 0 - no)","default":"0","type":"string","name":"deactivate_new_ambassador","_id":"56464c86a74cd10d00a3f021"},{"in":"query","required":false,"desc":"If the customer is not an ambassador, create them (1 - yes, 0 - no)","default":"0 (1 if you signed up before Nov 5 2013)","type":"string","name":"auto_create","_id":"56464c86a74cd10d00a3f020","ref":""},{"name":"add_to_group_id","ref":"","required":false,"type":"string","_id":"56464d5c56fb450d00410046","default":"","desc":"Define which group(s) new ambassadors will be created in. Using this parameter will override default group settings. Group IDs should be separated by commas If add_to_group_id=-1, then ambassador will not be added to any group","in":"query"},{"type":"string","_id":"5653251d57978b1700df7166","default":"","desc":"Define which group(s) existing ambassadors will be put in. Using this parameter will override default group settings and an ambassador's current groups. Group IDs should be separated by commas","in":"query","name":"set_groups","ref":"","required":false},{"type":"string","name":"street","_id":"565326d77d29410d004a0833","ref":"","in":"query","required":false,"desc":"Your customer's street","default":""},{"desc":"Your customer's city","default":"","type":"string","name":"city","_id":"565326d77d29410d004a0832","ref":"","in":"query","required":false},{"name":"state","_id":"565326f2a95dea0d00a30690","ref":"","in":"query","required":false,"desc":"Your customer's state","default":"","type":"string"},{"ref":"","in":"query","required":false,"desc":"Your customer's zip","default":"","type":"string","name":"zip","_id":"565326f2a95dea0d00a3068f"},{"in":"query","required":false,"desc":"Your customer's country","default":"","type":"string","name":"country","_id":"565326f2a95dea0d00a3068e","ref":""},{"desc":"Your customer's phone","default":"","type":"string","name":"phone","_id":"573b6725ef164e2900a2b8d2","ref":"","in":"query","required":false},{"name":"paypal_email","_id":"57ea9c981780cd170064f290","ref":"","in":"query","required":false,"desc":"Your customer's PayPal email address","default":"","type":"string"},{"ref":"","in":"query","required":false,"desc":"Your customer's Company name","default":"","type":"string","name":"company","_id":"57ea9c981780cd170064f28f"},{"ref":"","required":false,"type":"string","_id":"5887bfceba8f5c0f0010c5f8","default":"","desc":"Your customer's status if you have opted to create a new ambassador if the customer is not found (auto_create = 1).  Valid values are enrolled, prospect, banned and unsubscribed.","in":"query","name":"status"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"response\": {\n    \"code\": \"200\",\n    \"message\": \"OK: The request was successful. See response body for additional data.\",\n    \"data\": {\n      \"referring_ambassador\": {\n        \"first_name\": \"Jane\",\n        \"last_name\": \"Doe\",\n        \"email\": \"jane@example.com\",\n        \"uid\": null,\n        \"commission\": null,\n        \"balance_money\": \"2.40\",\n        \"balance_points\": \"0\",\n        \"memorable_url\": \"http://mbsy.co/Developers/djane\",\n        \"unique_referrals\": \"1\",\n        \"sandbox\": \"0\",\n        \"custom1\": null,\n        \"custom2\": null,\n        \"custom3\": null\n      },\n      \"ambassador\": {\n        \"first_name\": \"John\",\n        \"last_name\": \"Doe\",\n        \"email\": \"john@example.com\",\n        \"uid\": null,\n        \"balance_money\": \"0.00\",\n        \"balance_points\": \"0\",\n        \"money_paid\": \"9.00\",\n        \"points_paid\": \"0.00\",\n        \"memorable_url\": \"http://mbsy.co/Developers/djohn\",\n        \"unique_referrals\": \"0\",\n        \"sandbox\": \"0\",\n        \"custom1\": null,\n        \"custom2\": null,\n        \"custom3\": null,\n        \"groups\": \"1,2,3\",\n        \"street\": null,\n        \"city\": null,\n        \"state\": null,\n        \"zip\": null,\n        \"country\": null,\n        \"phone\": \"\",\n        \"company\": \"Builder Co.\",\n        \"paypal_email\": \"john@example.com\",\n        \"campaign_links\": [\n          {\n            \"campaign_uid\": \"25\",\n            \"campaign_name\": \"Refer a Company\",\n            \"sandbox\": \"0\",\n            \"private\": \"0\",\n            \"facebook_enabled\": \"0\",\n            \"campaign_description\": \"Refer a new company to Ambassador and get rewarded 50% of their first payment and 10% of each recurring payment!\",\n            \"url\": \"http:\\/\\/mbsy.co\\/8l\",\n            \"total_money_earned\": \"0\",\n            \"total_points_earned\": \"0\"\n          }\n        ]\n      }\n    }\n  }\n}","name":""},{"status":400,"language":"json","code":"{\n  \"response\": {\n    \"code\": \"400\",\n    \"message\": \"BAD REQUEST: The parameters provided were invalid. See response body for error messages.\",\n    \"errors\": {\n      \"error\": [\n        \"The following POST parameter is required: \\\"email\\\".\"\n      ]\n    }\n  }\n}","name":""}]},"settings":"","url":"/ambassador/get/","auth":"required","examples":{"codes":[{"code":"curl https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/ambassador/get/ \\\n-H \"Content-Type: application/json\" \\\n-d '{\"email\":\"johndoe@example.com\"}' \\\n-X GET","name":"","language":"curl"},{"code":"<?php\n    error_reporting(E_ALL);\n    ini_set(\"display_errors\", 1);\n\n    $username = '[[app:username]]';\n    $api_key = '[[app:key]]';\n    $response_type = 'json';\n\n    // Build and make API call\n    $data = array('email' => 'johndoe@example.com',\n                'sandbox' => '1');\n    $data = http_build_query($data);\n    $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/ambassador/get/';\n    $curl_handle = curl_init();\n    curl_setopt($curl_handle, CURLOPT_URL, $url);\n    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POST, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);\n    curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n    $response = curl_exec($curl_handle);\n    curl_close($curl_handle);\n\n    echo($response);\n\n    // Example parsing of JSON response\n    if(strtolower($response_type) == 'json')\n    {\n        // Decode response to array\n        $response = json_decode($response, TRUE);\n\n        if(isset($response['response']) && $response['response']['code'] == '200')\n        {\n            // Loop through and output share links\n            if(isset($response['response']['data']['ambassador']['campaign_links']))\n            {\n                foreach($response['response']['data']['ambassador']['campaign_links'] as $ary => $response_row)\n                {\n                    echo \"Campaign Link: \".$response_row['url'].\"\\n\\n\";\n                }\n            }\n        } else {\n            echo 'Error, see response dump above.';\n        }\n    }\n?>","language":"php"}]}},"editedParams":true,"hidden":false,"order":2,"parentDoc":null,"updates":[],"body":"","editedParams2":true,"link_external":false,"project":"5634abe66d460f0d0061264f","type":"get","__v":7,"excerpt":"Retrieves details about a given ambassador including their active share links. Can automatically create the requested ambassador if they do not exist yet.","githubsync":"","slug":"ambassadorget","sync_unique":"","user":"5634abcb8b86331700b48916","version":"5634abe66d460f0d00612652","category":"56464ea136961e0d005c61a5","childrenPages":[]}

get/ambassador/get/

Retrieves details about a given ambassador including their active share links. Can automatically create the requested ambassador if they do not exist yet.

Query Params

email:
required
string
Your customer's email address
uid:
string
Your customer's internal unique ID
first_name:
string
Your customer's first name
last_name:
string
Your customer's last name
custom1:
string
Custom field - related to ambassador
custom2:
string
Custom field - related to ambassador
custom3:
string
Custom field - related to ambassador
email_new_ambassador:
string1
Email login credentials to new ambassadors (1 - yes, 0 - no)
sandbox:
string0
New ambassadors created for testing (1 - yes, 0 - no)
deactivate_new_ambassador:
string0
New ambassadors created are deactivated (1 - yes, 0 - no)
auto_create:
string0 (1 if you signed up before Nov 5 2013)
If the customer is not an ambassador, create them (1 - yes, 0 - no)
add_to_group_id:
string
Define which group(s) new ambassadors will be created in. Using this parameter will override default group settings. Group IDs should be separated by commas If add_to_group_id=-1, then ambassador will not be added to any group
set_groups:
string
Define which group(s) existing ambassadors will be put in. Using this parameter will override default group settings and an ambassador's current groups. Group IDs should be separated by commas
street:
string
Your customer's street
city:
string
Your customer's city
state:
string
Your customer's state
zip:
string
Your customer's zip
country:
string
Your customer's country
phone:
string
Your customer's phone
paypal_email:
string
Your customer's PayPal email address
company:
string
Your customer's Company name
status:
string
Your customer's status if you have opted to create a new ambassador if the customer is not found (auto_create = 1). Valid values are enrolled, prospect, banned and unsubscribed.

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"56539275b47dea17009dbcac","type":"get","version":"5634abe66d460f0d00612652","isReference":true,"body":"","excerpt":"Retrieves statistics about a given ambassador including a summary and per-campaign report of their earned commissions, generated revenue, shares, share clicks and unique referrals as well as shares, share clicks, and unique referrals per social channel. Can automatically create the requested ambassador if they do not exist yet.","githubsync":"","hidden":false,"link_url":"","sync_unique":"","updates":[],"__v":1,"category":"56464ea136961e0d005c61a5","createdAt":"2015-11-23T22:25:57.644Z","editedParams":true,"editedParams2":true,"api":{"settings":"","url":"/ambassador/stats/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/ambassador/stats/ \\\n-H \"Content-Type: application/json\" \\\n-d '{\"email\":\"johndoe@example.com\"}' \\\n-X GET","name":""},{"code":"<?php\n    error_reporting(E_ALL);\n    ini_set(\"display_errors\", 1);\n\n    $username = '[[app:username]]';\n    $api_key = '[[app:key]]';\n    $response_type = 'json';\n\n    // Build and make API call\n    $data = array('email' => 'johndoe@example.com');\n    $data = http_build_query($data);\n    $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/ambassador/stats/';\n    $curl_handle = curl_init();\n    curl_setopt($curl_handle, CURLOPT_URL, $url);\n    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POST, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);\n    curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n    $response = curl_exec($curl_handle);\n    curl_close($curl_handle);\n\n    echo($response);\n\n    // Example parsing of JSON response\n    if(strtolower($response_type) == 'json')\n    {\n        // Decode response to array\n        $response = json_decode($response, TRUE);\n\n        if(isset($response['response']) && $response['response']['code'] == '200')\n        {\n            // Loop through and output share links\n            if(isset($response['response']['data']['ambassador']['stats_summary']))\n            {\n                echo \"Stats Summary Array\";\n                print_r($response['response']['data']['ambassador']['stats_summary']);\n            }\n        } else {\n            echo 'Error, see response dump above.';\n        }\n    }\n?>","language":"php"}]},"method":"get","params":[{"ref":"","required":true,"type":"string","in":"query","_id":"5638e73a68b11f0d0048c901","default":"","desc":"Your customer's email address","name":"email"},{"in":"query","_id":"5646491936961e0d005c619a","default":"","desc":"Your customer's internal unique ID","name":"uid","ref":"","required":false,"type":"string"},{"type":"string","in":"query","_id":"56464ae5c7687d0d00739e9f","default":"","desc":"Your customer's first name","name":"first_name","ref":"","required":false},{"name":"last_name","ref":"","required":false,"type":"string","in":"query","_id":"56464ae5c7687d0d00739e9e","default":"","desc":"Your customer's last name"},{"default":"","desc":"Custom field - related to ambassador","name":"custom1","ref":"","required":false,"type":"string","in":"query","_id":"56464ae5c7687d0d00739e9d"},{"required":false,"type":"string","in":"query","_id":"56464c86a74cd10d00a3f024","default":"","desc":"Custom field - related to ambassador","name":"custom2","ref":""},{"desc":"Custom field - related to ambassador","name":"custom3","ref":"","required":false,"type":"string","in":"query","_id":"56464c86a74cd10d00a3f023","default":""},{"ref":"","required":false,"type":"string","in":"query","_id":"56464c86a74cd10d00a3f022","default":"1","desc":"Email login credentials to new ambassadors (1 - yes, 0 - no)","name":"email_new_ambassador"},{"in":"query","_id":"565394addb93750d008c9dfe","default":"0","desc":"New ambassadors created for testing (1 - yes, 0 - no)","name":"sandbox","ref":"","required":false,"type":"string"},{"default":"0","desc":"New ambassadors created are deactivated (1 - yes, 0 - no)","name":"deactivate_new_ambassador","ref":"","required":false,"type":"string","in":"query","_id":"56464c86a74cd10d00a3f021"},{"required":false,"type":"string","in":"query","_id":"56464c86a74cd10d00a3f020","default":"0 (1 if you signed up before Nov 5 2013)","desc":"If the customer is not an ambassador, create them","name":"auto_create","ref":""},{"required":false,"type":"yyyy-mm-dd","in":"query","_id":"565394addb93750d008c9dfd","default":"all time","desc":"Retrieve stats starting at this date (inclusive)","name":"start_date","ref":""},{"desc":"Retrieve stats ending at this date (inclusive)","name":"end_date","ref":"","required":false,"type":"yyyy-mm-dd","in":"query","_id":"565394addb93750d008c9dfc","default":"today"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"response\":{\n    \"code\":\"200\",\n    \"message\":\"OK: The request was successful. See response body for additional data.\",\n    \"data\":{\n      \"referring_ambassador\":{\n        \"first_name\":null,\n        \"last_name\":null,\n        \"email\":\"jane@example.com\",\n        \"uid\":null,\n        \"commission\":null,\n        \"balance_money\":\"0.00\",\n        \"balance_points\":\"0.00\",\n        \"memorable_url\":\"http:\\/\\/mbsy.co\\/Developers\\/djane\",\n        \"unique_referrals\":\"8\",\n        \"sandbox\":\"0\",\n        \"custom1\": null,\n        \"custom2\": null,\n        \"custom3\": null\n      },\n      \"ambassador\":{\n        \"first_name\":null,\n        \"last_name\":null,\n        \"email\":\"john@example.com\",\n        \"uid\":null,\n        \"balance_money\":\"0.00\",\n        \"balance_points\":\"0.00\",\n        \"memorable_url\":\"http:\\/\\/mbsy.co\\/Developers\\/djohn\",\n        \"unique_referrals\":\"0\",\n        \"sandbox\":\"0\",\n        \"custom1\": null,\n        \"custom2\": null,\n        \"custom3\": null,\n        \"stats_summary\":{\n          \"start_date\":\"2012-04-10\",\n          \"end_date\":\"2012-06-22\",\n          \"commissions\":{\n            \"pending_count\":\"0\",\n            \"approved_count\":\"0\",\n            \"denied_count\":\"0\",\n            \"pending_sum\":\"0\",\n            \"approved_sum\":\"0\",\n            \"denied_sum\":\"0\"\n          },\n          \"revenue\":{\n            \"pending_sum\":\"0\",\n            \"approved_sum\":\"0\",\n            \"denied_sum\":\"0\"\n          },\n          \"count_clicks\":\"0\",\n          \"count_shares\":\"0\",\n          \"unique_referrals\":\"0\",\n          \"channels\":{\n            \"email\":{\n              \"count_shares\":\"0\",\n              \"count_clicks\":\"N\\/A\",\n              \"unique_referrals\":\"0\",\n              \"commissions\":{\n                \"pending_count\":\"0\",\n                \"approved_count\":\"0\",\n                \"denied_count\":\"0\",\n                \"pending_sum\":\"0\",\n                \"approved_sum\":\"0\",\n                \"denied_sum\":\"0\"\n              },\n              \"revenue\":{\n                \"pending_sum\":\"0\",\n                \"approved_sum\":\"0\",\n                \"denied_sum\":\"0\"\n              }\n            },\n            \"facebook\":{\n              \"count_shares\":\"0\",\n              \"count_clicks\":\"0\",\n              \"unique_referrals\":\"0\",\n              \"commissions\":{\n                \"pending_count\":\"0\",\n                \"approved_count\":\"0\",\n                \"denied_count\":\"0\",\n                \"pending_sum\":\"0\",\n                \"approved_sum\":\"0\",\n                \"denied_sum\":\"0\"\n              },\n              \"revenue\":{\n                \"pending_sum\":\"0\",\n                \"approved_sum\":\"0\",\n                \"denied_sum\":\"0\"\n              }\n            }\n          }\n        },\n        \"campaign_links\":[\n          {\n            \"campaign_uid\":\"82\",\n            \"campaign_name\":\"Campaign One\",\n            \"campaign_description\":\"This is an example campaign description\",\n            \"sandbox\":\"0\",\n            \"private\":\"0\",\n            \"facebook_enabled\":\"1\",\n            \"url\":\"http:\\/\\/mbsy.co\\/bJj\",\n            \"total_money_earned\":\"0.00\",\n            \"total_points_earned\":\"0.00\",\n            \"unique_referrals\":\"0\",\n            \"stats\":{\n              \"commissions\":{\n                \"pending_count\":\"0\",\n                \"approved_count\":\"0\",\n                \"denied_count\":\"0\",\n                \"pending_sum\":\"0\",\n                \"approved_sum\":\"0\",\n                \"denied_sum\":\"0\"\n              },\n              \"revenue\":{\n                \"pending_sum\":\"0\",\n                \"approved_sum\":\"0\",\n                \"denied_sum\":\"0\"\n              },\n              \"count_clicks\":\"0\",\n              \"count_shares\":\"0\",\n              \"unique_referrals\":\"0\",\n              \"channels\":{\n                \"email\":{\n                  \"count_shares\":\"0\",\n                  \"count_clicks\":\"N\\/A\",\n                  \"unique_referrals\":\"0\",\n                  \"commissions\":{\n                    \"pending_count\":\"0\",\n                    \"approved_count\":\"0\",\n                    \"denied_count\":\"0\",\n                    \"pending_sum\":\"0\",\n                    \"approved_sum\":\"0\",\n                    \"denied_sum\":\"0\"\n                  },\n                  \"revenue\":{\n                    \"pending_sum\":\"0\",\n                    \"approved_sum\":\"0\",\n                    \"denied_sum\":\"0\"\n                  }\n                },\n                \"facebook\":{\n                  \"count_shares\":\"0\",\n                  \"count_clicks\":\"0\",\n                  \"unique_referrals\":\"0\",\n                  \"commissions\":{\n                    \"pending_count\":\"0\",\n                    \"approved_count\":\"0\",\n                    \"denied_count\":\"0\",\n                    \"pending_sum\":\"0\",\n                    \"approved_sum\":\"0\",\n                    \"denied_sum\":\"0\"\n                  },\n                  \"revenue\":{\n                    \"pending_sum\":\"0\",\n                    \"approved_sum\":\"0\",\n                    \"denied_sum\":\"0\"\n                  }\n                }\n              }\n            }\n          }\n        ]\n      },\n      \"company\":{\n        \"company_name\":\"Developers\",\n        \"company_url\":\"\",\n        \"company_email\":\"support@getambassador.com\",\n        \"point_name\":\"Month(s)\",\n        \"outgoing_email\":null,\n        \"avatar_url\":\"https:\\/\\/s3.amazonaws.com\\/ambassador\\/avatars\\/1088_1339785224.jpg\"\n      }\n    }\n  }\n}","name":""},{"status":400,"language":"json","code":"{\n  \"response\": {\n    \"code\": \"400\",\n    \"message\": \"BAD REQUEST: The parameters provided were invalid. See response body for error messages.\",\n    \"errors\": {\n      \"error\": [\n        \"The following POST parameter is required: \\\"email\\\".\"\n      ]\n    }\n  }\n}","name":""}]}},"link_external":false,"order":3,"parentDoc":null,"project":"5634abe66d460f0d0061264f","slug":"ambassadorstats","title":"/ambassador/stats/","user":"5634abcb8b86331700b48916","childrenPages":[]}

get/ambassador/stats/

Retrieves statistics about a given ambassador including a summary and per-campaign report of their earned commissions, generated revenue, shares, share clicks and unique referrals as well as shares, share clicks, and unique referrals per social channel. Can automatically create the requested ambassador if they do not exist yet.

Query Params

email:
required
string
Your customer's email address
uid:
string
Your customer's internal unique ID
first_name:
string
Your customer's first name
last_name:
string
Your customer's last name
custom1:
string
Custom field - related to ambassador
custom2:
string
Custom field - related to ambassador
custom3:
string
Custom field - related to ambassador
email_new_ambassador:
string1
Email login credentials to new ambassadors (1 - yes, 0 - no)
sandbox:
string0
New ambassadors created for testing (1 - yes, 0 - no)
deactivate_new_ambassador:
string0
New ambassadors created are deactivated (1 - yes, 0 - no)
auto_create:
string0 (1 if you signed up before Nov 5 2013)
If the customer is not an ambassador, create them
start_date:
yyyy-mm-ddall time
Retrieve stats starting at this date (inclusive)
end_date:
yyyy-mm-ddtoday
Retrieve stats ending at this date (inclusive)

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"56539d4f852b961700d49d7c","category":"56464ea136961e0d005c61a5","isReference":true,"link_external":false,"order":4,"slug":"ambassadorall","sync_unique":"","title":"/ambassador/all/","user":"5634abcb8b86331700b48916","version":"5634abe66d460f0d00612652","excerpt":"Retrieves a list of up to 100 ambassadors meeting the provided thresholds.","hidden":false,"next":{"description":"","pages":[]},"parentDoc":null,"project":"5634abe66d460f0d0061264f","updates":[],"githubsync":"","type":"get","__v":5,"api":{"method":"get","params":[{"_id":"56539d4f852b961700d49d7e","ref":"","in":"query","required":false,"desc":"Page number of paginated results","default":"100","type":"int","name":"page"},{"_id":"56e0420df97d422900d6395c","ref":"","in":"query","required":false,"desc":"Minimum monetary balance (inclusive)","default":"","type":"double","name":"min_money"},{"_id":"56e0420df97d422900d6395b","ref":"","in":"query","required":false,"desc":"Minimum point balance (inclusive)","default":"","type":"int","name":"min_points"},{"_id":"56e0420df97d422900d6395a","ref":"","in":"query","required":false,"desc":"Minimum unique referrals (inclusive)","default":"","type":"int","name":"min_referrals"},{"_id":"5638e73a68b11f0d0048c901","ref":"","in":"query","required":false,"desc":"Filter by email address","default":"","type":"string","name":"email"},{"_id":"5646491936961e0d005c619a","ref":"","in":"query","required":false,"desc":"Filter by uid","default":"","type":"string","name":"uid"},{"_id":"56e0420df97d422900d63959","ref":"","in":"query","required":false,"desc":"1 - Returns only active ambassadors, 0 - Returns only deactivated ambassadors, when variable is not used all ambassadors are returned","default":"","type":"string","name":"is_active"},{"_id":"57f3ce6dab0ee12000bef97f","ref":"","in":"query","required":false,"desc":"Filter by ambassadors created on or before the date provided","default":"","type":"string","name":"created_at__lte"},{"_id":"57f3ce6dab0ee12000bef97e","ref":"","in":"query","required":false,"desc":"Filter by ambassadors created or or after the given date","default":"","type":"string","name":"created_at__gte"},{"_id":"58651f1881b5450f001e4105","ref":"","in":"query","required":false,"desc":"New ambassadors created for testing (1 - yes, 0 - no)","default":"0","type":"int","name":"sandbox"},{"_id":"5a131341ff108e003ef70273","ref":"","in":"query","required":false,"desc":"Filter by the group uid found in the URL of the segment details page","default":"","type":"string","name":"group"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"response\": {\n    \"code\": \"200\",\n    \"message\": \"OK: The request was successful. See response body for additional data.\",\n    \"data\": {\n      \"ambassadors\": [\n        {\n          \"first_name\": \"Jane\",\n          \"last_name\": \"Doe\",\n          \"email\": \"jane@example.com\",\n          \"uid\": \"142\",\n          \"balance_money\": \"0.00\",\n          \"balance_points\": \"0\",\n          \"money_paid\": \"0.00\",\n          \"points_paid\": \"0.00\",\n          \"memorable_url\": \"http://mbsy.co/Developers/djane\",\n          \"unique_referrals\": \"0\",\n          \"sandbox\": \"0\",\n          \"created_at\": \"2012-04-10T16:15:19+0000\",\n          \"fraud_score\": 0,\n          \"fraud_score_human_readable\": null,\n          \"fraud_score_percent_ui\": 0,\n          \"fraud_reasons\": {}\n        },\n        {\n          \"first_name\": \"John\",\n          \"last_name\": \"Doe\",\n          \"email\": \"john@example.com\",\n          \"uid\": \"143\",\n          \"balance_money\": \"0.00\",\n          \"balance_points\": \"0\",\n          \"money_paid\": \"0.00\",\n          \"points_paid\": \"0.00\",\n          \"memorable_url\": \"http://mbsy.co/Developers/djohn\",\n          \"unique_referrals\": \"0\",\n          \"sandbox\": \"0\",\n          \"created_at\": \"2012-01-31T20:20:42+0000\",\n          \"fraud_score\": 0,\n          \"fraud_score_human_readable\": null,\n          \"fraud_score_percent_ui\": 0,\n          \"fraud_reasons\": {}\n        },\n        {\n          \"first_name\": \"Bob\",\n          \"last_name\": \"Doe\",\n          \"email\": \"bob@example.com\",\n          \"uid\": \"144\",\n          \"balance_money\": \"0.00\",\n          \"balance_points\": \"0\",\n          \"money_paid\": \"0.00\",\n          \"points_paid\": \"0.00\",\n          \"memorable_url\": \"http://mbsy.co/Developers/dbob\",\n          \"unique_referrals\": \"0\",\n          \"sandbox\": \"0\",\n          \"created_at\": \"2012-01-31T19:57:27+0000\",\n          \"fraud_score\": 0,\n          \"fraud_score_human_readable\": null,\n          \"fraud_score_percent_ui\": 0,\n          \"fraud_reasons\": {}\n        }\n      ]\n    }\n  }\n}","name":""},{"language":"json","code":"{\n  \"response\": {\n    \"code\": \"400\",\n    \"message\": \"BAD REQUEST: The parameters provided were invalid. See response body for error messages.\",\n    \"errors\": {\n      \"error\": [\n        \"The following POST parameters are not numbers. \\\"page\\\", \\\"min_money\\\", \\\"min_points\\\", \\\"min_referrals\\\".\"\n      ]\n    }\n  }\n}","name":"","status":400}]},"settings":"","url":"/ambassador/all/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/ambassador/all/ \\\n-H \"Content-Type: application/json\" \\\n-X GET","name":""},{"language":"curl","code":"curl https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/ambassador/all/ \\\n-H \"Content-Type: application/json\" \\\n-d '{\"min_referrals\": 100}' \\\n-X GET"},{"language":"php","code":"<?php\n    error_reporting(E_ALL);\n    ini_set(\"display_errors\", 1);\n\n    $username = '[[app:username]]';\n    $api_key = '[[app:key]]';\n    $response_type = 'json';\n\n    // Build and make API call\n    $data = array('page' => '1');\n    $data = http_build_query($data);\n    $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/ambassador/all/';\n    $curl_handle = curl_init();\n    curl_setopt($curl_handle, CURLOPT_URL, $url);\n    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POST, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);\n    curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n    $response = curl_exec($curl_handle);\n    curl_close($curl_handle);\n\n    echo($response);\n\n    // Example parsing of JSON response\n    if(strtolower($response_type) == 'json')\n    {\n        // Decode response to array\n        $response = json_decode($response, TRUE);\n\n        if(isset($response['response']) && $response['response']['code'] == '200')\n        {\n            // Loop through and output ambassadors\n            if(isset($response['response']['data']['ambassadors']))\n            {\n                foreach($response['response']['data']['ambassadors'] as $ary => $response_row)\n                {\n                    echo \"Ambassador: \".$response_row['email'].\"\\n\\n\";\n                }\n            }\n        } else {\n            echo 'Error, see response dump above.';\n        }\n    }\n?>"}]}},"body":"","createdAt":"2015-11-23T23:12:15.598Z","editedParams":true,"editedParams2":true,"link_url":"","childrenPages":[]}

get/ambassador/all/

Retrieves a list of up to 100 ambassadors meeting the provided thresholds.

Query Params

page:
integer100
Page number of paginated results
min_money:
double
Minimum monetary balance (inclusive)
min_points:
integer
Minimum point balance (inclusive)
min_referrals:
integer
Minimum unique referrals (inclusive)
email:
string
Filter by email address
uid:
string
Filter by uid
is_active:
string
1 - Returns only active ambassadors, 0 - Returns only deactivated ambassadors, when variable is not used all ambassadors are returned
created_at__lte:
string
Filter by ambassadors created on or before the date provided
created_at__gte:
string
Filter by ambassadors created or or after the given date
sandbox:
integer0
New ambassadors created for testing (1 - yes, 0 - no)
group:
string
Filter by the group uid found in the URL of the segment details page

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"56df3af6382a212000e76265","createdAt":"2016-03-08T20:49:58.559Z","githubsync":"","isReference":true,"slug":"ambassadorupdate","title":"/ambassador/update/","updates":[],"category":"56464ea136961e0d005c61a5","order":5,"project":"5634abe66d460f0d0061264f","__v":6,"api":{"auth":"required","examples":{"codes":[{"code":"curl https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/ambassador/update \\\n-H \"Content-Type: application/json\" \\\n-d '{\"email\": \"johndoe@example.com\", \"first_name\": \"John\", \"last_name\": \"Doe\" }' \\\n-X POST","language":"curl"},{"code":"<?php\n    error_reporting(E_ALL);\n    ini_set(\"display_errors\", 1);\n\n    $username = '[[app:username]]';\n    $api_key = '[[app:key]]';\n    $response_type = 'json';\n\n    // Build and make API call\n    $data = array('email' => 'old_email@example.com',\n        'new_email' => 'new_email@example.com');\n    $data = http_build_query($data);\n    $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/ambassador/update/';\n    $curl_handle = curl_init();\n    curl_setopt($curl_handle, CURLOPT_URL, $url);\n    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POST, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);\n    curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n    $response = curl_exec($curl_handle);\n    curl_close($curl_handle);\n\n    echo($response);\n\n    // Example parsing of JSON response\n    if(strtolower($response_type) == 'json')\n    {\n        // Decode response to array\n        $response = json_decode($response, TRUE);\n\n         var_dump($response);\n    }\n?>","language":"php"}]},"method":"post","params":[{"name":"uid","_id":"56df3c3f2e97772900d5cbe3","ref":"","in":"body","required":false,"desc":"Your ambassador's internal unique ID","default":"","type":"string"},{"type":"string","name":"email","_id":"56df3c3f2e97772900d5cbe2","ref":"","in":"body","required":false,"desc":"Your ambassador's email address","default":""},{"desc":"New email","default":"","type":"string","name":"new_email","_id":"56df3c3f2e97772900d5cbe1","ref":"","in":"body","required":false},{"_id":"56df3c3f2e97772900d5cbe0","ref":"","in":"body","required":false,"desc":"New uid","default":"","type":"string","name":"new_uid"},{"name":"paypal_email","_id":"56df3c3f2e97772900d5cbdf","ref":"","in":"body","required":false,"desc":"New Paypal email","default":"","type":"string"},{"type":"string","name":"first_name","_id":"56df3c3f2e97772900d5cbde","ref":"","in":"body","required":false,"desc":"New First name","default":""},{"required":false,"desc":"New Last name","default":"","type":"string","name":"last_name","_id":"56df3c3f2e97772900d5cbdd","ref":"","in":"body"},{"ref":"","in":"body","required":false,"desc":"Custom field","default":"","type":"string","name":"custom1","_id":"56df3c3f2e97772900d5cbdc"},{"default":"","type":"string","name":"custom2","_id":"56df3c3f2e97772900d5cbdb","ref":"","in":"body","required":false,"desc":"Custom field"},{"default":"","type":"string","name":"custom3","_id":"56df3c3f2e97772900d5cbda","ref":"","in":"body","required":false,"desc":"Custom3"},{"default":"","type":"string","name":"is_deactivated","_id":"56df3c3f2e97772900d5cbd9","ref":"","in":"body","required":false,"desc":"1 - deactivate ambassador. 0 - activate ambassador."},{"default":"","type":"string","name":"send_welcome_email","_id":"56df3c3f2e97772900d5cbd8","ref":"","in":"body","required":false,"desc":"Send welcome email (1 - yes, 0 - no)"},{"in":"body","required":false,"desc":"Your customer's street","default":"","type":"string","name":"street","_id":"5728cc011a8eb619007a74c0","ref":""},{"desc":"Your customer's city","default":"","type":"string","name":"city","_id":"5728ccae1a8eb619007a74c5","ref":"","in":"body","required":false},{"name":"state","_id":"5728ccae1a8eb619007a74c4","ref":"","in":"body","required":false,"desc":"Your customer's state","default":"","type":"string"},{"ref":"","in":"body","required":false,"desc":"Your customer's zip","default":"","type":"string","name":"zip","_id":"5728ccae1a8eb619007a74c3"},{"in":"body","required":false,"desc":"Your customer's country","default":"","type":"string","name":"country","_id":"5728ccae1a8eb619007a74c2","ref":""},{"desc":"Your customer's phone number","default":"","type":"string","name":"phone","_id":"57a0d4cae0f97d220044e5d2","ref":"","in":"body","required":false},{"name":"paypal_email","_id":"57ea9c5f802e4a17009181b8","ref":"","in":"body","required":false,"desc":"Your customer's PayPal email address","default":"","type":"string"},{"type":"string","name":"company","_id":"57ea9c5f802e4a17009181b7","ref":"","in":"body","required":false,"desc":"Your customer's Company name","default":""},{"required":false,"desc":"Define which group(s) existing ambassadors will be put in. Using this parameter will override default group settings and an ambassador's current groups. Group IDs should be separated by commas","default":"","type":"string","name":"set_groups","_id":"5887c0868240cd0f008fd9f0","ref":"","in":"body"}],"results":{"codes":[{"status":200,"name":"","code":"{\n  \"response\": {\n    \"code\": \"200\",\n    \"message\": \"OK: The request was successful. See response body for additional data.\",\n    \"data\": {\n      \"message\": \"Ambassador updated successfully.\"\n    }\n  }\n}","language":"json"},{"name":"","code":"{\n  \"response\": {\n    \"code\": \"400\",\n    \"message\": \"BAD REQUEST: The parameters provided were invalid. See response body for error messages.\",\n    \"errors\": {\n      \"error\": [\n        \"The following GET/POST parameter is required: uid or email.\"\n      ]\n    }\n  }\n}","language":"json","status":400}]},"settings":"","url":"/ambassador/update"},"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"is_deactivated\",\n  \"body\": \"Deactivation will change the ambassador's status to Banned.\"\n}\n[/block]","editedParams":true,"editedParams2":true,"excerpt":"Updates existing ambassador data. \n\nNOTE: To identify ambassador in our system you can choose either 'uid' or 'email'. If both are used then 'uid' takes precedence.","link_external":false,"version":"5634abe66d460f0d00612652","hidden":false,"link_url":"","next":{"description":"","pages":[]},"parentDoc":null,"sync_unique":"","type":"post","user":"56ddedf5502b132000191327","childrenPages":[]}

post/ambassador/update/

Updates existing ambassador data. NOTE: To identify ambassador in our system you can choose either 'uid' or 'email'. If both are used then 'uid' takes precedence.

Body Params

uid:
string
Your ambassador's internal unique ID
email:
string
Your ambassador's email address
new_email:
string
New email
new_uid:
string
New uid
paypal_email:
string
New Paypal email
first_name:
string
New First name
last_name:
string
New Last name
custom1:
string
Custom field
custom2:
string
Custom field
custom3:
string
Custom3
is_deactivated:
string
1 - deactivate ambassador. 0 - activate ambassador.
send_welcome_email:
string
Send welcome email (1 - yes, 0 - no)
street:
string
Your customer's street
city:
string
Your customer's city
state:
string
Your customer's state
zip:
string
Your customer's zip
country:
string
Your customer's country
phone:
string
Your customer's phone number
paypal_email:
string
Your customer's PayPal email address
company:
string
Your customer's Company name
set_groups:
string
Define which group(s) existing ambassadors will be put in. Using this parameter will override default group settings and an ambassador's current groups. Group IDs should be separated by commas
[block:callout] { "type": "warning", "title": "is_deactivated", "body": "Deactivation will change the ambassador's status to Banned." } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



[block:callout] { "type": "warning", "title": "is_deactivated", "body": "Deactivation will change the ambassador's status to Banned." } [/block]
{"_id":"56df55791a50f60e00cc4115","editedParams2":true,"excerpt":"Deducts from the running commission balance of an ambassador.","user":"56ddedf5502b132000191327","category":"56464ea136961e0d005c61a5","createdAt":"2016-03-08T22:43:05.560Z","githubsync":"","order":6,"parentDoc":null,"slug":"balancededuct","type":"post","updates":[],"__v":0,"editedParams":true,"version":"5634abe66d460f0d00612652","project":"5634abe66d460f0d0061264f","sync_unique":"","title":"/balance/deduct/","api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/balance/deduct/ \\\n-H \"Content-Type: application/json\" \\\n-d '{\"email\": \"johndoe@example.com\", \"amount\": 1.00}' \\\n-X POST"},{"language":"php","code":"<?php\n    error_reporting(E_ALL);\n    ini_set(\"display_errors\", 1);\n\n    $username = '[[app:username]]';\n    $api_key = '[[app:key]]';\n    $response_type = 'json';\n\n    // Build and make API call\n    $data = array('email' => 'johndoe@example.com',\n                    'amount' => '1',\n                    'sandbox' => '1');\n    $data = http_build_query($data);\n    $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/balance/deduct/';\n    $curl_handle = curl_init();\n    curl_setopt($curl_handle, CURLOPT_URL, $url);\n    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POST, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);\n    curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n    $response = curl_exec($curl_handle);\n    curl_close($curl_handle);\n\n    echo($response);\n\n    // Example parsing of JSON response\n    if(strtolower($response_type) == 'json')\n    {\n        // Decode response to array\n        $response = json_decode($response, TRUE);\n\n        if(isset($response['response']) && $response['response']['code'] == '200')\n        {\n            // Output updated balance for the ambassador\n            if(isset($response['response']['data']['balance']))\n            {\n                foreach($response['response']['data']['balance'] as $response_row)\n                {\n                    echo $response_row.\"\\n\\n\";\n                }\n            }\n        } else {\n            echo 'Error, see response dump above.';\n        }\n    }\n?>\n "}]},"method":"post","params":[{"_id":"56df55791a50f60e00cc4120","ref":"","required":true,"desc":"Your customer's email address","default":"","type":"string","name":"email","in":"body"},{"_id":"56df55791a50f60e00cc411f","ref":"","required":true,"desc":"Amount to deduct","default":"0","type":"double","name":"amount","in":"body"},{"in":"body","_id":"56df55791a50f60e00cc411e","ref":"","required":false,"desc":"Your customer's internal unique ID","default":"","type":"string","name":"uid"},{"name":"custom1","in":"body","_id":"56df55791a50f60e00cc411d","ref":"","required":false,"desc":"Custom field","default":"","type":"string"},{"desc":"Custom field","default":"","type":"string","name":"custom2","in":"body","_id":"56df55791a50f60e00cc411c","ref":"","required":false},{"ref":"","required":false,"desc":"Custom field","default":"","type":"string","name":"custom3","in":"body","_id":"56df55791a50f60e00cc411b"},{"type":"string","name":"type","in":"body","_id":"56df55791a50f60e00cc411a","ref":"","required":false,"desc":"\"money\" or \"points\"","default":"money"},{"desc":"Email login credentials to new ambassadors (1 - yes, 0 - no)","name":"email_new_ambassador","ref":"","required":false,"type":"string","in":"body","_id":"56df55791a50f60e00cc4119","default":"1"},{"name":"sandbox","ref":"","required":false,"type":"string","in":"body","_id":"56df55791a50f60e00cc4118","default":"0","desc":"New ambassadors created for testing (1 - yes, 0 - no)"},{"default":"0","desc":"New ambassadors created are deactivated (1 - yes, 0 - no)","name":"deactivate_new_ambassador","ref":"","required":false,"type":"string","in":"body","_id":"56df55791a50f60e00cc4117"},{"desc":"If the customer is not an ambassador, create them (1 - yes, 0 - no)","name":"auto_create","ref":"","required":false,"type":"string","in":"body","_id":"56df55791a50f60e00cc4116","default":"0 (if you signed up before Nov 5 2013)"}],"results":{"codes":[{"name":"","code":"{\n  \"response\": {\n    \"code\": \"200\",\n    \"message\": \"OK: The request was successful. See response body for additional data.\",\n    \"data\": {\n      \"ambassador\": {\n        \"first_name\": \"\",\n        \"last_name\": \"\",\n        \"created_at\": \"2016-03-09T14:15:58.056+0000\",\n        \"email\": \"johndoe@example.com\",\n        \"uid\": null,\n        \"platform_id\": 46818,\n        \"balance_money\": \"0.00\",\n        \"balance_points\": \"0.00\",\n        \"memorable_url\": \"http://staging.mbsy.co/Developers/1996\",\n        \"unique_referrals\": null,\n        \"count_shares\": \"39\",\n        \"sandbox\": \"0\",\n        \"custom1\": \"\",\n        \"custom2\": \"\",\n        \"custom3\": \"\",\n        \"groups\": \"177,229\",\n        \"street\": \"\",\n        \"city\": \"\",\n        \"state\": \"\",\n        \"zip\": \"\",\n        \"country\": \"\",\n        \"campaign_links\": [\n          {\n            \"campaign_uid\": \"25\",\n            \"campaign_name\": \"Refer a Company\",\n            \"sandbox\": \"0\",\n            \"private\": \"0\",\n            \"facebook_enabled\": \"0\",\n            \"campaign_description\": \"Refer a new company to Ambassador and get rewarded 50% of their first payment and 10% of each recurring payment!\",\n            \"url\": \"http:\\/\\/mbsy.co\\/8l\",\n            \"total_money_earned\": \"0\",\n            \"total_points_earned\": \"0\"\n          }\n        ]\n      },\n      \"company\": {\n        \"company_name\": \"Example Company\",\n        \"company_url\": \"http:\\/\\/example.com\",\n        \"company_email\": \"John@example.com\",\n        \"point_name\": \"Month(s)\",\n        \"outgoing_email\": \"email@example.com\",\n        \"avatar_url\": \"https:\\/\\/s3.amazonaws.com\\/example\\/avatars\\/sample.jpg\"\n      },\n      \"balance\": {\n        \"old\": \"2.00\",\n        \"new\": 1,\n        \"type\": \"money\"\n      }\n    }\n  }\n}","language":"json","status":200},{"name":"","code":"{\n  \"response\": {\n    \"code\": \"400\",\n    \"message\": \"BAD REQUEST: The parameters provided were invalid. See response body for error messages.\",\n    \"errors\": {\n      \"error\": [\n        \"The following GET/POST parameters are required: email, type, amount.\"\n      ]\n    }\n  }\n}","language":"json","status":400}]},"settings":"","url":"/balance/deduct/"},"body":"","isReference":true,"link_external":false,"link_url":"","hidden":false,"childrenPages":[]}

post/balance/deduct/

Deducts from the running commission balance of an ambassador.

Body Params

email:
required
string
Your customer's email address
amount:
required
double0
Amount to deduct
uid:
string
Your customer's internal unique ID
custom1:
string
Custom field
custom2:
string
Custom field
custom3:
string
Custom field
type:
stringmoney
"money" or "points"
email_new_ambassador:
string1
Email login credentials to new ambassadors (1 - yes, 0 - no)
sandbox:
string0
New ambassadors created for testing (1 - yes, 0 - no)
deactivate_new_ambassador:
string0
New ambassadors created are deactivated (1 - yes, 0 - no)
auto_create:
string0 (if you signed up before Nov 5 2013)
If the customer is not an ambassador, create them (1 - yes, 0 - no)

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"56e032a19032720e00032d01","sync_unique":"","updates":[],"__v":1,"category":"56464ea136961e0d005c61a5","githubsync":"","parentDoc":null,"api":{"params":[{"ref":"","required":true,"desc":"Your customer's email address","default":"","type":"string","name":"email","in":"body","_id":"56e0340bf97d422900d6391b"},{"desc":"Amount to add","name":"amount","ref":"","required":true,"type":"double","in":"body","_id":"56e0340bf97d422900d6391a","default":""},{"desc":"Your customer's internal unique ID","default":"","type":"string","name":"uid","in":"body","_id":"56e0340bf97d422900d63919","ref":"","required":false},{"name":"custom1","in":"body","_id":"56e0340bf97d422900d63918","ref":"","required":false,"desc":"Custom field","default":"","type":"string"},{"desc":"Custom field","default":"","type":"string","name":"custom2","in":"body","_id":"56e0340bf97d422900d63917","ref":"","required":false},{"name":"custom3","in":"body","_id":"56e0340bf97d422900d63916","ref":"","required":false,"desc":"Custom field","default":"","type":"string"},{"default":"money","type":"string","name":"type","in":"body","_id":"56e0340bf97d422900d63915","ref":"","required":false,"desc":"Balance type to add (\"money\" or \"points\")"},{"_id":"56e0340bf97d422900d63914","ref":"","required":false,"desc":"Email login credentials to new ambassadors","default":"1","type":"int","name":"email_new_ambassador","in":"body"},{"in":"body","_id":"56e0340bf97d422900d63913","ref":"","required":false,"desc":"New ambassadors created for testing (1 - yes, 0 - no)","default":"0","type":"int","name":"sandbox"},{"name":"deactivate_new_ambassador","in":"body","_id":"56e0340bf97d422900d63912","ref":"","required":false,"desc":"New ambassadors created are deactivated (1 - yes, 0 - no)","default":"0","type":"int"},{"default":"0 (1 if you signed up before Nov 5 2013)","type":"int","name":"auto_create","in":"body","_id":"56e0340bf97d422900d63911","ref":"","required":false,"desc":"If the customer is not an ambassador, create them (1 - yes, 0 - no)"}],"results":{"codes":[{"name":"","code":"{\n  \"response\": {\n    \"code\": \"200\",\n    \"message\": \"OK: The request was successful. See response body for additional data.\",\n    \"data\": {\n      \"ambassador\": {\n        \"first_name\": \"John\",\n        \"last_name\": \"Doe\",\n        \"email\": \"john@example.com\",\n        \"uid\": null,\n        \"balance_money\": 0,\n        \"balance_points\": 0,\n        \"memorable_url\": \"http://mbsy.co/USERNAME/djohn\",\n        \"unique_referrals\": 0,\n        \"sandbox\": \"0\",\n        \"custom1\": null,\n        \"custom2\": null,\n        \"custom3\": null,\n        \"campaign_links\": [\n          {\n            \"campaign_uid\": \"25\",\n            \"campaign_name\": \"Refer a Company\",\n            \"sandbox\": \"0\",\n            \"private\": \"0\",\n            \"facebook_enabled\": \"0\",\n            \"campaign_description\": \"Refer a new company to Ambassador and get rewarded 50% of their first payment and 10% of each recurring payment!\",\n            \"url\": \"http:\\/\\/mbsy.co\\/8l\",\n            \"total_money_earned\": \"0\",\n            \"total_points_earned\": \"0\"\n          }\n        ]\n      },\n      \"company\": {\n      \"company_name\": \"Example Company\",\n      \"company_url\": \"http:\\/\\/example.com\",\n      \"company_email\": \"John@example.com\",\n      \"point_name\": \"Month(s)\",\n      \"outgoing_email\": \"email@example.com\",\n      \"avatar_url\": \"https:\\/\\/s3.amazonaws.com\\/example\\/avatars\\/sample.jpg\"\n      },\n      \"balance\": {\n        \"old\": \"1.00\",\n        \"new\": 2,\n        \"type\": \"money\"\n      }\n    }\n  }\n}","language":"curl","status":200},{"name":"","code":"{\n  \"response\": {\n    \"code\": \"400\",\n    \"message\": \"BAD REQUEST: The parameters provided were invalid. See response body for error messages.\",\n    \"errors\": {\n      \"error\": [\n        \"The following GET/POST parameters are required: email, type, amount.\"\n      ]\n    }\n  }\n}","language":"json","status":400}]},"settings":"","url":"/balance/add/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/balance/add/ \\\n-H \"Content-Type: application/json\" \\\n-d '{\"email\": \"johndoe@example.com\", \"amount\": 1.00}' \\\n-X POST"},{"code":"<?php\n    error_reporting(E_ALL);\n    ini_set(\"display_errors\", 1);\n\n    $username = '[[app:username]]';\n    $api_key = '[[app:key]]';\n    $response_type = 'json';\n\n    // Build and make API call\n    $data = array('email' => 'johndoe@example.com',\n                    'amount' => '1',\n                    'sandbox' => '1');\n    $data = http_build_query($data);\n    $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/balance/add/';\n    $curl_handle = curl_init();\n    curl_setopt($curl_handle, CURLOPT_URL, $url);\n    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POST, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);\n    curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n    $response = curl_exec($curl_handle);\n    curl_close($curl_handle);\n\n    echo($response);\n\n    // Example parsing of JSON response\n    if(strtolower($response_type) == 'json')\n    {\n        // Decode response to array\n        $response = json_decode($response, TRUE);\n\n        if(isset($response['response']) && $response['response']['code'] == '200')\n        {\n            // Output updated balance for the ambassador\n            if(isset($response['response']['data']['balance']))\n            {\n                foreach($response['response']['data']['balance'] as $response_row)\n                {\n                    echo $response_row.\"\\n\\n\";\n                }\n            }\n        } else {\n            echo 'Error, see response dump above.';\n        }\n    }\n?>","language":"php"}]},"method":"post"},"editedParams":true,"hidden":false,"order":7,"project":"5634abe66d460f0d0061264f","slug":"balanceadd","type":"post","body":"","createdAt":"2016-03-09T14:26:41.470Z","editedParams2":true,"link_external":false,"user":"56ddedf5502b132000191327","version":"5634abe66d460f0d00612652","title":"/balance/add/","excerpt":"Adds to the running commission balance of an ambassador.","isReference":true,"link_url":"","childrenPages":[]}

post/balance/add/

Adds to the running commission balance of an ambassador.

Body Params

email:
required
string
Your customer's email address
amount:
required
double
Amount to add
uid:
string
Your customer's internal unique ID
custom1:
string
Custom field
custom2:
string
Custom field
custom3:
string
Custom field
type:
stringmoney
Balance type to add ("money" or "points")
email_new_ambassador:
integer1
Email login credentials to new ambassadors
sandbox:
integer0
New ambassadors created for testing (1 - yes, 0 - no)
deactivate_new_ambassador:
integer0
New ambassadors created are deactivated (1 - yes, 0 - no)
auto_create:
integer0 (1 if you signed up before Nov 5 2013)
If the customer is not an ambassador, create them (1 - yes, 0 - no)

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"56e047475fc52e320024d87e","editedParams":true,"isReference":true,"link_external":false,"order":8,"project":"5634abe66d460f0d0061264f","title":"/shortcode/get/","version":"5634abe66d460f0d00612652","body":"","createdAt":"2016-03-09T15:54:47.057Z","editedParams2":true,"githubsync":"","user":"56ddedf5502b132000191327","api":{"url":"/shortcode/get/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/shortcode/get/ \\\n-H \"Content-Type: application/json\" \\\n-d '{\"short_code\": \"test\"}' \\\n-X GET"},{"language":"php","code":"<?php\n    error_reporting(E_ALL);\n    ini_set(\"display_errors\", 1);\n\n    $username = '[[app:username]]';\n    $api_key = '[[app:key]]';\n    $response_type = 'json';\n\n    // Build and make API call\n    $data = array('short_code' => 'a',\n                'sandbox' => '1');\n    $data = http_build_query($data);\n    $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/shortcode/get/';\n    $curl_handle = curl_init();\n    curl_setopt($curl_handle, CURLOPT_URL, $url);\n    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POST, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);\n    curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n    $response = curl_exec($curl_handle);\n    curl_close($curl_handle);\n\n    echo($response);\n\n    // Example parsing of JSON response\n    if(strtolower($response_type) == 'json')\n    {\n        // Decode response to array\n        $response = json_decode($response, TRUE);\n\n        if(isset($response['response']) && $response['response']['code'] == '200')\n        {\n            // Loop through and output shortcode data\n            if(isset($response['response']['data']['shortcode']))\n            {\n                foreach($response['response']['data']['shortcode'] as $response_row)\n                {\n                    echo $response_row.\"\\n\\n\";\n                }\n            }\n        } else {\n            echo 'Error, see response dump above.';\n        }\n    }\n?>"}]},"method":"get","params":[{"_id":"56e079514685db1700d94870","ref":"","required":true,"desc":"The \"mbsy\" variable passed via GET or POST","default":"","type":"string","name":"short_code","in":"query"},{"type":"string","_id":"56e079514685db1700d9486f","default":"0","desc":"Does the short code belong to a test campaign? (1 - yes, 0 - no)","in":"query","name":"sandbox","ref":"","required":false}],"results":{"codes":[{"status":200,"name":"","code":"{\n  \"response\": {\n    \"code\": \"200\",\n    \"message\": \"OK: The request was successful. See response body for additional data.\",\n    \"data\": {\n      \"shortcode\": {\n          \"valid\": 1,\n          \"sandbox\": \"0\",\n          \"discount_value\": \"abc123\",\n          \"first_name\": \"Jane\",\n          \"last_name\": \"Doe\",\n          \"email\": \"johndoe@example.com\",\n          \"uid\": \"17296\",\n          \"campaign_uid\": \"17\",\n          \"campaign_name\": \"Username Reservations\",\n          \"campaign_description\": \"Get 5 of your friends to reserve their Ambassador username and get an Ambassador t-shirt!\",\n          \"custom1\": \"data1\",\n          \"custom2\": \"data2\",\n          \"custom3\": \"data3\"\n      }\n    }\n  }\n}","language":"json"},{"name":"","code":"{\n  \"response\": {\n    \"code\": \"400\",\n    \"message\": \"BAD REQUEST: The parameters provided were invalid. See response body for error messages.\",\n    \"errors\": {\n      \"error\": [\n        \"The following GET/POST parameter is required: short_code.\"\n      ]\n    }\n  }\n}","language":"json","status":400}]},"settings":""},"category":"56464ea136961e0d005c61a5","link_url":"","slug":"shortcodeget","sync_unique":"","type":"get","updates":[],"__v":1,"excerpt":"Retrieves the referring ambassador and campaign information tied to an “mbsy” shortcode.","hidden":false,"parentDoc":null,"childrenPages":[]}

get/shortcode/get/

Retrieves the referring ambassador and campaign information tied to an “mbsy” shortcode.

Query Params

short_code:
required
string
The "mbsy" variable passed via GET or POST
sandbox:
string0
Does the short code belong to a test campaign? (1 - yes, 0 - no)

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"56e080814685db1700d9487e","user":"56ddedf5502b132000191327","version":"5634abe66d460f0d00612652","hidden":false,"link_url":"","updates":[],"githubsync":"","link_external":false,"order":9,"type":"post","__v":3,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Implementation of AddThis:\"\n}\n[/block]\nTo facilitate the socialization of API-based implementations we also return an AddThis sharing snippet for each campaign link in the API response. If you decide to utilize this snippet, you will need to include some javascript lines to make AddThis work. You may read more about how to integrate AddThis into your website at [the official AddThis website](http://addthis.com/).\n\nYou may optionally allow us to track shares from your AddThis implementation by including the following JavaScript at the bottom of your AddThis-enabled page.\n\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"AddThis Listener:\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script type=\\\"text/javascript\\\">\\n    function shareEventHandler(evt){\\n        if (evt.type == 'addthis.menu.share'){\\n            // set this variable equal to the campaign share URL being shared\\n            // setting this will be dependent on how you set up AddThis on your site\\n            var share_url = \\\"SET_URL_BEING_SHARED_HERE\\\";\\n            // ------------------------------------------------------------------\\n            var url_fragments = share_url.split(\\\"/\\\");\\n            var short_code = url_fragments[url_fragments.length-1];\\n            var xmlhttp;\\n            if (window.XMLHttpRequest){\\n                // code for IE7+, Firefox, Chrome, Opera, Safari\\n                xmlhttp=new XMLHttpRequest();\\n            }else{\\n                // code for IE6, IE5\\n                xmlhttp=new ActiveXObject(\\\"Microsoft.XMLHTTP\\\");\\n            }\\n\\n            xmlhttp.open(\\\"GET\\\",\\\"https://getambassador.com/share_tracker/track_share?short_code=\\\"+short_code+\\\"&social_name=\\\"+evt.data.service+\\\"\\\",true);\\n            xmlhttp.send();\\n        }\\n    }\\n    // Attach the listener to AddThis\\n    addthis.addEventListener('addthis.menu.share', shareEventHandler);\\n</script>\\n \\n\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nYou may optionally choose to disable [address bar sharing analytics](http://bit.ly/11gQ2eG) by including the following JavaScript at the bottom of your AddThis-enabled page.\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Disable address bar tracking:\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script type=\\\"text/javascript\\\">\\n    var addthis_config = addthis_config||{};\\n    addthis_config.data_track_addressbar = false;\\n</script>\\n\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]","excerpt":"Retrieves an AddThis snippet for all active campaigns for one of your customers.","editedParams":true,"editedParams2":true,"parentDoc":null,"title":"/social/addthis/","api":{"auth":"required","examples":{"codes":[{"code":"curl https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/social/addthis/ \\\n-H \"Content-Type: application/json\" \\\n-d '{\"email\": \"jane@example.com\"}' \\\n-X POST","language":"curl"},{"code":"<?php\n    error_reporting(E_ALL);\n    ini_set(\"display_errors\", 1);\n\n    $username = '[[app:username]]';\n    $api_key = '[[app:key]]';\n    $response_type = 'json';\n\n    // Build and make API call\n    $data = array('email' => 'johndoe@example.com',\n                'sandbox' => '1');\n    $data = http_build_query($data);\n    $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/social/addthis/';\n    $curl_handle = curl_init();\n    curl_setopt($curl_handle, CURLOPT_URL, $url);\n    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POST, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);\n    curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n    $response = curl_exec($curl_handle);\n    curl_close($curl_handle);\n\n    echo($response);\n\n    // Example parsing of JSON response\n    if(strtolower($response_type) == 'json')\n    {\n        // Decode response to array\n        $response = json_decode($response, TRUE);\n\n        if(isset($response['response']) && $response['response']['code'] == '200')\n        {\n            // Loop through and output addthis data\n            if(isset($response['response']['data']['ambassador']['addthis']))\n            {\n                foreach($response['response']['data']['ambassador']['addthis'] as $response_array)\n                {\n                    foreach($response_array as $response_row)\n                    {\n                        echo $response_row.\"\\n\\n\";\n                    }\n                }\n            }\n        } else {\n            echo 'Error, see response dump above.';\n        }\n    }\n?>","language":"php"}]},"method":"post","params":[{"desc":"Your customer's email address","default":"","type":"string","name":"email","in":"body","_id":"56e085b583a6461700f8e927","ref":"","required":true},{"ref":"","required":false,"desc":"Your customers's internal unique ID","default":"","type":"string","name":"uid","in":"body","_id":"56e085b583a6461700f8e926"},{"required":false,"desc":"Your customer's first name","default":"","type":"string","name":"first_name","in":"body","_id":"56e085b583a6461700f8e925","ref":""},{"default":"","type":"string","name":"last_name","in":"body","_id":"56e085b583a6461700f8e924","ref":"","required":false,"desc":"Your customer's last name"},{"in":"body","_id":"56e085b583a6461700f8e923","ref":"","required":false,"desc":"Custom field","default":"","type":"string","name":"custom1"},{"ref":"","required":false,"desc":"Custom field","default":"","type":"string","name":"custom2","in":"body","_id":"56e085b583a6461700f8e922"},{"type":"string","name":"custom3","in":"body","_id":"56e085b583a6461700f8e921","ref":"","required":false,"desc":"Custom field","default":""},{"required":false,"desc":"Default share message","default":"\"I'm an ambassador of...\"","type":"string","name":"message","in":"body","_id":"56e085b583a6461700f8e920","ref":""},{"name":"email_new_ambassador","ref":"","required":false,"type":"string","in":"body","_id":"56e085b583a6461700f8e91f","default":"1","desc":"Email login credentials to new ambassadors (1 - yes, 0 - no)"},{"type":"string","in":"body","_id":"56e085b583a6461700f8e91e","default":"0","desc":"New ambassadors created for testing (1 - yes, 0 - no)","name":"sandbox","ref":"","required":false},{"ref":"","required":false,"type":"string","in":"body","_id":"56e085b583a6461700f8e91d","default":"0","desc":"New ambassadors are deactivated (1 - yea, 0 - no)","name":"deactivate_new_ambassador"},{"_id":"56e085b583a6461700f8e91c","default":"0 (1 if you signed up before Nov 5 2103)","desc":"If the customer is not an ambassador, create them (1 - yes, 0 - no)","name":"auto_create","ref":"","required":false,"type":"string","in":"body"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"response\": {\n    \"code\": \"200\",\n    \"message\": \"OK: The request was successful. See response body for additional data.\",\n    \"data\": {\n      \"referring_ambassador\": {\n        \"first_name\": null,\n        \"last_name\": null,\n        \"email\": null,\n        \"uid\": null,\n        \"commission\": null,\n        \"balance_money\": 0,\n        \"balance_points\": 0,\n        \"memorable_url\": \"http://mbsy.co\",\n        \"unique_referrals\": 0,\n        \"sandbox\": 0,\n        \"custom1\": null,\n        \"custom2\": null,\n        \"custom3\": null\n      },\n      \"ambassador\": {\n        \"first_name\": \"Jane\",\n        \"last_name\": \"Doe\",\n        \"email\": \"jane@example.com\",\n        \"uid\": null,\n        \"balance_money\": 0,\n        \"balance_points\": 0,\n        \"memorable_url\": \"http://mbsy.co/Developers/djane\",\n        \"unique_referrals\": 0,\n        \"sandbox\": \"0\",\n        \"custom1\": null,\n        \"custom2\": null,\n        \"custom3\": null\n        \"addthis\": [\n          {\n            \"campaign_uid\": \"25\",\n            \"campaign_name\": \"Refer a Company\",\n            \"sandbox\": \"0\",\n            \"private\": \"0\",\n            \"facebook_enabled\": \"0\",\n            \"campaign_description\": \"Refer a new company to Ambassador and get rewarded 50% of their first payment and 10% of each recurring payment!\",\n            \"url\": \"http:\\/\\/mbsy.co\\/8m\",\n            \"total_money_earned\": \"0\",\n            \"total_points_earned\": \"0\",\n            \"snippet\": \"<center><div style=\\\"text-align:center;width:350px;\\\" class=\\\"addthis_toolbox addthis_default_style addthis_32x32_style\\\" addthis:url=\\\"http:\\/\\/mbsy.co\\/8m\\\" addthis:title=\\\"I'm an Ambassador of Example\\\"><a class=\\\"addthis_button_facebook\\\"><\\/a><a class=\\\"addthis_button_twitter\\\" tw:via=\\\"GetAmbassador\\\"><\\/a><a class=\\\"addthis_button_stumbleupon\\\"><\\/a><a class=\\\"addthis_button_linkedin\\\"><\\/a><a class=\\\"addthis_button_tumblr\\\"><\\/a><a class=\\\"addthis_button_email\\\"><\\/a><a class=\\\"addthis_button_wordpress\\\"><\\/a><a class=\\\"addthis_button_compact\\\"><\\/a><a class=\\\"addthis_counter addthis_bubble_style\\\"><\\/a><\\/div><\\/center>\"\n          }\n        ]\n      }\n    }\n  }\n}","name":""},{"status":400,"language":"json","code":"{\n  \"response\": {\n    \"code\": \"400\",\n    \"message\": \"BAD REQUEST: The parameters provided were invalid. See response body for error messages.\",\n    \"errors\": {\n      \"error\": [\n        \"The following GET/POST parameter is required: email.\"\n      ]\n    }\n  }\n}","name":""}]},"settings":"","url":"/social/addthis/"},"category":"56464ea136961e0d005c61a5","createdAt":"2016-03-09T19:58:57.564Z","slug":"socialaddthis","sync_unique":"","isReference":true,"project":"5634abe66d460f0d0061264f","childrenPages":[]}

post/social/addthis/

Retrieves an AddThis snippet for all active campaigns for one of your customers.

Body Params

email:
required
string
Your customer's email address
uid:
string
Your customers's internal unique ID
first_name:
string
Your customer's first name
last_name:
string
Your customer's last name
custom1:
string
Custom field
custom2:
string
Custom field
custom3:
string
Custom field
message:
string"I'm an ambassador of..."
Default share message
email_new_ambassador:
string1
Email login credentials to new ambassadors (1 - yes, 0 - no)
sandbox:
string0
New ambassadors created for testing (1 - yes, 0 - no)
deactivate_new_ambassador:
string0
New ambassadors are deactivated (1 - yea, 0 - no)
auto_create:
string0 (1 if you signed up before Nov 5 2103)
If the customer is not an ambassador, create them (1 - yes, 0 - no)
[block:api-header] { "type": "basic", "title": "Implementation of AddThis:" } [/block] To facilitate the socialization of API-based implementations we also return an AddThis sharing snippet for each campaign link in the API response. If you decide to utilize this snippet, you will need to include some javascript lines to make AddThis work. You may read more about how to integrate AddThis into your website at [the official AddThis website](http://addthis.com/). You may optionally allow us to track shares from your AddThis implementation by including the following JavaScript at the bottom of your AddThis-enabled page. [block:api-header] { "type": "basic", "title": "AddThis Listener:" } [/block] [block:code] { "codes": [ { "code": "<script type=\"text/javascript\">\n function shareEventHandler(evt){\n if (evt.type == 'addthis.menu.share'){\n // set this variable equal to the campaign share URL being shared\n // setting this will be dependent on how you set up AddThis on your site\n var share_url = \"SET_URL_BEING_SHARED_HERE\";\n // ------------------------------------------------------------------\n var url_fragments = share_url.split(\"/\");\n var short_code = url_fragments[url_fragments.length-1];\n var xmlhttp;\n if (window.XMLHttpRequest){\n // code for IE7+, Firefox, Chrome, Opera, Safari\n xmlhttp=new XMLHttpRequest();\n }else{\n // code for IE6, IE5\n xmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\n }\n\n xmlhttp.open(\"GET\",\"https://getambassador.com/share_tracker/track_share?short_code=\"+short_code+\"&social_name=\"+evt.data.service+\"\",true);\n xmlhttp.send();\n }\n }\n // Attach the listener to AddThis\n addthis.addEventListener('addthis.menu.share', shareEventHandler);\n</script>\n \n", "language": "javascript" } ] } [/block] You may optionally choose to disable [address bar sharing analytics](http://bit.ly/11gQ2eG) by including the following JavaScript at the bottom of your AddThis-enabled page. [block:api-header] { "type": "basic", "title": "Disable address bar tracking:" } [/block] [block:code] { "codes": [ { "code": "<script type=\"text/javascript\">\n var addthis_config = addthis_config||{};\n addthis_config.data_track_addressbar = false;\n</script>\n", "language": "javascript" } ] } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



[block:api-header] { "type": "basic", "title": "Implementation of AddThis:" } [/block] To facilitate the socialization of API-based implementations we also return an AddThis sharing snippet for each campaign link in the API response. If you decide to utilize this snippet, you will need to include some javascript lines to make AddThis work. You may read more about how to integrate AddThis into your website at [the official AddThis website](http://addthis.com/). You may optionally allow us to track shares from your AddThis implementation by including the following JavaScript at the bottom of your AddThis-enabled page. [block:api-header] { "type": "basic", "title": "AddThis Listener:" } [/block] [block:code] { "codes": [ { "code": "<script type=\"text/javascript\">\n function shareEventHandler(evt){\n if (evt.type == 'addthis.menu.share'){\n // set this variable equal to the campaign share URL being shared\n // setting this will be dependent on how you set up AddThis on your site\n var share_url = \"SET_URL_BEING_SHARED_HERE\";\n // ------------------------------------------------------------------\n var url_fragments = share_url.split(\"/\");\n var short_code = url_fragments[url_fragments.length-1];\n var xmlhttp;\n if (window.XMLHttpRequest){\n // code for IE7+, Firefox, Chrome, Opera, Safari\n xmlhttp=new XMLHttpRequest();\n }else{\n // code for IE6, IE5\n xmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\n }\n\n xmlhttp.open(\"GET\",\"https://getambassador.com/share_tracker/track_share?short_code=\"+short_code+\"&social_name=\"+evt.data.service+\"\",true);\n xmlhttp.send();\n }\n }\n // Attach the listener to AddThis\n addthis.addEventListener('addthis.menu.share', shareEventHandler);\n</script>\n \n", "language": "javascript" } ] } [/block] You may optionally choose to disable [address bar sharing analytics](http://bit.ly/11gQ2eG) by including the following JavaScript at the bottom of your AddThis-enabled page. [block:api-header] { "type": "basic", "title": "Disable address bar tracking:" } [/block] [block:code] { "codes": [ { "code": "<script type=\"text/javascript\">\n var addthis_config = addthis_config||{};\n addthis_config.data_track_addressbar = false;\n</script>\n", "language": "javascript" } ] } [/block]
{"_id":"56e1a627150ed52d0062c613","__v":5,"body":"","createdAt":"2016-03-10T16:51:51.068Z","order":10,"parentDoc":null,"project":"5634abe66d460f0d0061264f","slug":"companyget","excerpt":"Retrieves details about your company and your active campaigns.\n\nReward types:\n\n* P - Percentage Monetary\n* F - Flat Monetary\n* N - Percentage Non-Monetary\n* M - Flat Non-Monetary\n* D - None","updates":[],"api":{"params":[],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"response\": {\n    \"code\": \"200\",\n    \"message\": \"OK: The request was successful. See response body for additional data.\",\n    \"data\": {\n      \"company\": {\n        \"company_name\": \"Sample\",\n        \"company_url\": \"\",\n        \"company_email\": \"johndoe@example.com\",\n        \"point_name\": \"points\",\n        \"outgoing_email\": \"sample@example.com\"\n      },\n      \"campaigns\": [\n        {\n          \"campaign_uid\": \"17\",\n          \"campaign_name\": \"Sample Campaign 1\",\n          \"campaign_description\": \"Get 5 of your friends to reserve their username and get a t-shirt!\",\n          \"campaign_description\": \"This is a sample description s\",\n          \"initial_reward\": {\n            \"type_text\": \"Flat Monetary\",\n            \"type_code\": \"F\",\n            \"amount\": \"10\"\n          },\n          \"recurring_reward\": {\n            \"type_text\": \"None\",\n            \"type_code\": \"D\",\n            \"amount\": \"0\"\n          },\n          \"landing_page\": \"https:\\/\\/example.com\\/reserve\",\n          \"sandbox\": \"0\",\n          \"private\": \"1\",\n          \"facebook_enabled\": \"0\",\n          \"auto_approve_commissions\": \"1\",\n          \"discount_value\": \"df59df8\",\n          \"start_date\": \"1314918000\",\n          \"end_date\": null,\n          \"user_message\": \"I thought you would like Ambassador -- it's simple, intuitive referral software for businesses.  To get 10% off, use my referral link:\",\n          \"company_message\": \"Increase your Social Marketing ROI with Ambassador. Ambassador gives you the tools to turn your customers into Brand Ambassadors. Sign up for a free trial:\",\n          \"subject\": \"Use this software to turn customers into Brand Ambassadors\",\n          \"social_message\": \"Looking for Social Media ROI? Check out Ambassador and get 10% off for a limited time.. #ambassador\"\n        },\n        {\n          \"campaign_uid\": \"25\",\n          \"campaign_name\": \"Sample Campaign 2\",\n          \"campaign_description\": \"Refer a new company to sample and get rewarded 50% of their first payment and 10% of each recurring payment!\",\n          \"initial_reward\": {\n            \"type_text\": \"Flat Monetary\",\n            \"type_code\": \"F\",\n            \"amount\": \"12\"\n          },\n          \"recurring_reward\": {\n            \"type_text\": \"None\",\n            \"type_code\": \"D\",\n            \"amount\": \"0\"\n          },\n          \"landing_page\": \"http:\\/\\/example.com\",\n          \"sandbox\": \"0\",\n          \"private\": \"1\",\n          \"facebook_enabled\": \"1\",\n          \"auto_approve_commissions\": \"1\",\n          \"discount_value\": \"0\",\n          \"start_date\": \"1315954800\",\n          \"end_date\": null,\n          \"user_message\": \"I thought you would like Ambassador -- it's simple, intuitive referral software for businesses.  To get 10% off, use my referral link:\",\n          \"company_message\": \"Increase your Social Marketing ROI with Ambassador. Ambassador gives you the tools to turn your customers into Brand Ambassadors. Sign up for a free trial:\",\n          \"subject\": \"Use this software to turn customers into Brand Ambassadors\",\n          \"social_message\": \"Looking for Social Media ROI? Check out Ambassador and get 10% off for a limited time.. #ambassador\"\n        }\n      ]\n    }\n  }\n}","name":""}]},"settings":"","url":"/company/get/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/company/get/ \\\n-H \"Content-Type: application/json\"\n"},{"language":"php","code":"<?php\n    error_reporting(E_ALL);\n    ini_set(\"display_errors\", 1);\n\n    $username = '[[app:username]]';\n    $api_key = '[[app:key]]';\n    $response_type = 'json';\n\n    // Build and make API call\n    $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/company/get/';\n    $curl_handle = curl_init();\n    curl_setopt($curl_handle, CURLOPT_URL, $url);\n    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POST, FALSE);\n    curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n    $response = curl_exec($curl_handle);\n    curl_close($curl_handle);\n\n    echo($response);\n\n    // Example parsing of JSON response\n    if(strtolower($response_type) == 'json')\n    {\n        // Decode response to array\n        $response = json_decode($response, TRUE);\n\n        if(isset($response['response']) && $response['response']['code'] == '200')\n        {\n            // Loop through and output company data\n            if(isset($response['response']['data']['company']))\n            {\n                foreach($response['response']['data']['company'] as $response_row)\n                {\n                    echo $response_row.\"\\n\\n\";\n                }\n            }\n        } else {\n            echo 'Error, see response dump above.';\n        }\n    }\n?>\n "}]},"method":"get"},"category":"56464ea136961e0d005c61a5","hidden":false,"isReference":true,"link_external":false,"link_url":"","sync_unique":"","githubsync":"","title":"/company/get/","type":"get","user":"56ddedf5502b132000191327","version":"5634abe66d460f0d00612652","childrenPages":[]}

get/company/get/

Retrieves details about your company and your active campaigns. Reward types: * P - Percentage Monetary * F - Flat Monetary * N - Percentage Non-Monetary * M - Flat Non-Monetary * D - None


User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"56e1a95187eeb13200c174bf","api":{"params":[],"results":{"codes":[{"name":"","status":200,"language":"json","code":"{\n  \"response\":{\n    \"code\":\"200\",\n    \"message\":\"OK: The request was successful. See response body for additional data.\",\n    \"data\":{\n      \"company\":{\n        \"company_name\":\"Sample\",\n        \"company_url\":\"\",\n        \"company_email\":\"johndoe@example.com\",\n        \"point_name\":\"points\",\n        \"outgoing_email\":null\n      },\n      \"stats\":{\n        \"production\":{\n          \"ambassadors\":{\n            \"activated_count\":\"82\",\n            \"deactivated_count\":\"1\"\n          },\n          \"campaigns\":{\n            \"active_count\":\"3\"\n          },\n          \"commissions\":{\n            \"pending_count\":\"33\",\n            \"approved_count\":\"3\",\n            \"denied_count\":\"1\",\n            \"pending_sum\":\"1044.5\",\n            \"approved_sum\":\"112\",\n            \"denied_sum\":\"25\"\n          },\n          \"revenue\":{\n            \"pending_sum\":\"3787.18\",\n            \"approved_sum\":\"15.28\",\n            \"denied_sum\":\"0\"\n          },\n          \"payouts\":{\n            \"pending_count\":\"0\",\n            \"paid_count\":\"4\",\n            \"denied_count\":\"0\",\n            \"pending_sum\":\"0\",\n            \"paid_sum\":\"5\",\n            \"denied_sum\":\"0\"\n          },\n          \"clicks\":{\n            \"count\":\"33\"\n          }\n        },\n        \"sandbox\":{\n          \"campaigns\":{\n            \"active_count\":\"6\"\n          },\n          \"clicks\":{\n            \"count\":\"2\"\n          }\n        }\n      }\n    }\n  }\n}"}]},"settings":"","url":"/company/stats/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/company/stats/ \\\n-H \"Content-Type: application/json\""},{"language":"php","code":"<?php\n    error_reporting(E_ALL);\n    ini_set(\"display_errors\", 1);\n\n    $username = '[[app:username]]';\n    $api_key = '[[app:key]]';\n    $response_type = 'json';\n\n    // Build and make API call\n    $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/company/stats/';\n    $curl_handle = curl_init();\n    curl_setopt($curl_handle, CURLOPT_URL, $url);\n    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POST, FALSE);\n    curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n    $response = curl_exec($curl_handle);\n    curl_close($curl_handle);\n\n    echo($response);\n\n    // Example parsing of JSON response\n    if(strtolower($response_type) == 'json')\n    {\n        // Decode response to array\n        $response = json_decode($response, TRUE);\n\n        if(isset($response['response']) && $response['response']['code'] == '200')\n        {\n            // Loop through and output production commission stats\n            if(isset($response['response']['data']['stats']['production']['commissions']))\n            {\n                foreach($response['response']['data']['stats']['production']['commissions'] as $response_field => $response_data)\n                {\n                    echo $response_field.\" = \".$response_data.\"\\n\\n\";\n                }\n            }\n        } else {\n            echo 'Error, see response dump above.';\n        }\n    }\n?>\n "}]},"method":"get"},"category":"56464ea136961e0d005c61a5","createdAt":"2016-03-10T17:05:21.270Z","isReference":true,"sync_unique":"","title":"/company/stats/","parentDoc":null,"project":"5634abe66d460f0d0061264f","type":"get","excerpt":"Retrieves high-level statistics about your company's referral program.","githubsync":"","link_external":false,"order":11,"__v":4,"body":"","hidden":false,"link_url":"","slug":"companystats","updates":[],"user":"56ddedf5502b132000191327","version":"5634abe66d460f0d00612652","childrenPages":[]}

get/company/stats/

Retrieves high-level statistics about your company's referral program.


User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"56e1aaef71e22d2b009801f6","githubsync":"","hidden":false,"parentDoc":null,"project":"5634abe66d460f0d0061264f","user":"56ddedf5502b132000191327","api":{"params":[],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"response\":{\n    \"code\":\"200\",\n    \"message\":\"OK: The request was successful. See response body for additional data.\",\n    \"data\":{\n      \"token\":\"cfeab99f171a70a900887212e42d1320\"\n    }\n  }\n}","name":""}]},"settings":"","url":"/company/token/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/company/token/ \\\n-H \"Content-Type: application/json\"\n"},{"language":"php","code":"<?php\n    error_reporting(E_ALL);\n    ini_set(\"display_errors\", 1);\n\n    $username = '[[app:username]]';\n    $api_key = '[[app:key]]';\n    $response_type = 'json';\n    $mbsy_token = '';\n\n    // Build and make API call\n    $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/company/token/';\n    $curl_handle = curl_init();\n    curl_setopt($curl_handle, CURLOPT_URL, $url);\n    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POST, FALSE);\n    curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n    $response = curl_exec($curl_handle);\n    curl_close($curl_handle);\n\n    echo($response);\n\n    // Example parsing of JSON response\n    if(strtolower($response_type) == 'json')\n    {\n        // Decode response to array\n        $response = json_decode($response, TRUE);\n\n        if(isset($response['response']) && $response['response']['code'] == '200')\n        {\n            // Output token\n            if(isset($response['response']['data']['token']))\n            {\n                $mbsy_token = $response['response']['data']['token'];\n                var_dump($mbsy_token);\n            }\n        } else {\n            echo 'Error, see response dump above.';\n        }\n    }\n\n?>"}]},"method":"get"},"body":"","link_external":false,"link_url":"","slug":"companytoken","sync_unique":"","title":"/company/token/","__v":4,"category":"56464ea136961e0d005c61a5","type":"get","updates":[],"excerpt":"Returns one-time token which is required for Single Sign-on.","isReference":true,"order":12,"version":"5634abe66d460f0d00612652","createdAt":"2016-03-10T17:12:15.473Z","childrenPages":[]}

get/company/token/

Returns one-time token which is required for Single Sign-on.


User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"56e1ac4ad2f9771900df1cb4","user":"56ddedf5502b132000191327","__v":0,"editedParams2":true,"title":"/company/emails/","type":"get","hidden":false,"sync_unique":"","editedParams":true,"excerpt":"Returns email statistics in total and by email types:\n\n* New Ambassador\n* Pending Commission\n* Approved Commission\n* Denied Commission\n* Fulfilled Payout\n\nThe data in the total field is the combined statistics for all email types. Each entry in total and email_types is split by date. To combine dates, use aggregate. If no date period is specified, the data returned is for the current day. If no date period is specified and aggregate is used the data is all-time totals.","githubsync":"","api":{"examples":{"codes":[{"language":"curl","code":"curl https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/company/emails/ \\\n-H \"Content-Type: application/json\" \\\n-d '{\"start_date\": \"2015-03-10\", \"end_date\": \"2016-03-10\"}' \\\n-X POST"},{"language":"php","code":"<?php\n    error_reporting(E_ALL);\n    ini_set(\"display_errors\", 1);\n\n    $username = '[[app:username]]';\n    $api_key = '[[app:key]]';\n    $response_type = 'json';\n    $mbsy_token = '';\n\n    // Build and make API call\n    $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/company/emails';\n    $curl_handle = curl_init();\n    curl_setopt($curl_handle, CURLOPT_URL, $url);\n    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POST, FALSE);\n    curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n    $response = curl_exec($curl_handle);\n    curl_close($curl_handle);\n\n    echo($response);\n\n    // Example parsing of JSON response\n    if(strtolower($response_type) == 'json')\n    {\n        // Decode response to array\n        $response = json_decode($response, TRUE);\n\n        if(isset($response['response']) && $response['response']['code'] == '200')\n        {\n            // Output token\n            if(isset($response['response']['data']['total']) && isset($response['response']['data']['email_types']\n            {\n                $total = $response['response']['data']['total'];\n                $email_types = $response['response']['data']['email_types'];\n\n                var_dump($total);\n                var_dump($email_types);\n            }\n        } else {\n            echo 'Error, see response dump above.';\n        }\n    }\n\n?>"}]},"method":"get","params":[{"desc":"The starting date to fetch email statistics. If used, must be used with end_date. (YYYY-MM-DD)","default":"","type":"yyyy-mm-dd","name":"start_date","in":"query","_id":"56e1ac4ad2f9771900df1cb7","ref":"","required":false},{"name":"end_date","in":"query","_id":"56e1ac4ad2f9771900df1cb6","ref":"","required":false,"desc":"The ending date to fetch email statistics. If used, must be used with start_date. (YYYY-MM-DD)","default":"","type":"yyyy-mm-dd"},{"ref":"","required":false,"type":"boolean","in":"query","_id":"56e1ac4ad2f9771900df1cb5","default":"","desc":"Combine email statistics based on date period (1 - yes, 0 - no)","name":"aggregate"}],"results":{"codes":[{"language":"json","code":"{\n  \"response\": {\n    \"code\": \"200\",\n    \"message\": \"OK: The request was successful. See response body for additional data.\",\n    \"data\": {\n      \"total\": [\n        {\n          \"delivered\": 8,\n          \"unsubscribes\": 0,\n          \"invalid_email\": 0,\n          \"bounces\": 0,\n          \"repeat_unsubscribes\": 0,\n          \"unique_clicks\": 0,\n          \"blocked\": 0,\n          \"spam_drop\": 0,\n          \"repeat_bounces\": 0,\n          \"repeat_spamreports\": 0,\n          \"date\": \"2013-06-13\",\n          \"requests\": 8,\n          \"spamreports\": 0,\n          \"clicks\": 0,\n          \"opens\": 15,\n          \"unique_opens\": 6\n        }\n      ],\n      \"email_types\": {\n        \"newAmbassador\": [\n          {\n            \"delivered\": 4,\n            \"unsubscribes\": 0,\n            \"invalid_email\": 0,\n            \"bounces\": 0,\n            \"repeat_unsubscribes\": 0,\n            \"unique_clicks\": 0,\n            \"blocked\": 0,\n            \"spam_drop\": 0,\n            \"repeat_bounces\": 0,\n            \"repeat_spamreports\": 0,\n            \"date\": \"2013-06-13\",\n            \"requests\": 4,\n            \"spamreports\": 0,\n            \"clicks\": 0,\n            \"opens\": 9,\n            \"unique_opens\": 3\n          }\n        ],\n        \"pendingCommission\": [\n          {\n            \"delivered\": 3,\n            \"unsubscribes\": 0,\n            \"invalid_email\": 0,\n            \"bounces\": 0,\n            \"repeat_unsubscribes\": 0,\n            \"unique_clicks\": 0,\n            \"blocked\": 0,\n            \"spam_drop\": 0,\n            \"repeat_bounces\": 0,\n            \"repeat_spamreports\": 0,\n            \"date\": \"2013-06-13\",\n            \"requests\": 3,\n            \"spamreports\": 0,\n            \"clicks\": 0,\n            \"opens\": 6,\n            \"unique_opens\": 3\n          }\n        ],\n        \"approvedCommission\": [\n          {\n            \"delivered\": 1,\n            \"unsubscribes\": 0,\n            \"invalid_email\": 0,\n            \"bounces\": 0,\n            \"repeat_unsubscribes\": 0,\n            \"unique_clicks\": 0,\n            \"blocked\": 0,\n            \"spam_drop\": 0,\n            \"repeat_bounces\": 0,\n            \"repeat_spamreports\": 0,\n            \"date\": \"2013-06-13\",\n            \"requests\": 1,\n            \"spamreports\": 0,\n            \"clicks\": 0,\n            \"opens\": 0,\n            \"unique_opens\": 0\n          }\n        ],\n        \"deniedCommission\": [\n          {\n            \"delivered\": 0,\n            \"unsubscribes\": 0,\n            \"invalid_email\": 0,\n            \"bounces\": 0,\n            \"repeat_unsubscribes\": 0,\n            \"unique_clicks\": 0,\n            \"blocked\": 0,\n            \"spam_drop\": 0,\n            \"repeat_bounces\": 0,\n            \"repeat_spamreports\": 0,\n            \"date\": \"2013-06-13\",\n            \"requests\": 0,\n            \"spamreports\": 0,\n            \"clicks\": 0,\n            \"opens\": 0,\n            \"unique_opens\": 0\n          }\n        ],\n        \"fulfilledPayout\": [\n          {\n            \"delivered\": 0,\n            \"unsubscribes\": 0,\n            \"invalid_email\": 0,\n            \"bounces\": 0,\n            \"repeat_unsubscribes\": 0,\n            \"unique_clicks\": 0,\n            \"blocked\": 0,\n            \"spam_drop\": 0,\n            \"repeat_bounces\": 0,\n            \"repeat_spamreports\": 0,\n            \"date\": \"2013-06-13\",\n            \"requests\": 0,\n            \"spamreports\": 0,\n            \"clicks\": 0,\n            \"opens\": 0,\n            \"unique_opens\": 0\n          }\n        ],\n        \"deniedPayout\": [\n          {\n            \"delivered\": 0,\n            \"unsubscribes\": 0,\n            \"invalid_email\": 0,\n            \"bounces\": 0,\n            \"repeat_unsubscribes\": 0,\n            \"unique_clicks\": 0,\n            \"blocked\": 0,\n            \"spam_drop\": 0,\n            \"repeat_bounces\": 0,\n            \"repeat_spamreports\": 0,\n            \"date\": \"2013-06-13\",\n            \"requests\": 0,\n            \"spamreports\": 0,\n            \"clicks\": 0,\n            \"opens\": 0,\n            \"unique_opens\": 0\n          }\n        ]\n      }\n    }\n  }\n}","name":"","status":200},{"code":"{}","name":"","status":400,"language":"json"}]},"settings":"","url":"/company/emails/","auth":"required"},"isReference":true,"order":13,"link_url":"","parentDoc":null,"project":"5634abe66d460f0d0061264f","slug":"companyemails","body":"","category":"56464ea136961e0d005c61a5","createdAt":"2016-03-10T17:18:02.431Z","link_external":false,"updates":[],"version":"5634abe66d460f0d00612652","childrenPages":[]}

get/company/emails/

Returns email statistics in total and by email types: * New Ambassador * Pending Commission * Approved Commission * Denied Commission * Fulfilled Payout The data in the total field is the combined statistics for all email types. Each entry in total and email_types is split by date. To combine dates, use aggregate. If no date period is specified, the data returned is for the current day. If no date period is specified and aggregate is used the data is all-time totals.

Query Params

start_date:
yyyy-mm-dd
The starting date to fetch email statistics. If used, must be used with end_date. (YYYY-MM-DD)
end_date:
yyyy-mm-dd
The ending date to fetch email statistics. If used, must be used with start_date. (YYYY-MM-DD)
aggregate:
boolean
Combine email statistics based on date period (1 - yes, 0 - no)

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"56e1af4506fe670e003f968a","githubsync":"","isReference":true,"link_url":"","slug":"groupall","body":"","hidden":false,"parentDoc":null,"project":"5634abe66d460f0d0061264f","sync_unique":"","title":"/group/all/","user":"56ddedf5502b132000191327","createdAt":"2016-03-10T17:30:45.324Z","type":"get","__v":5,"category":"56464ea136961e0d005c61a5","excerpt":"Retrieves a list of and details about your company's groups.","link_external":false,"next":{"description":"","pages":[]},"order":14,"updates":[],"version":"5634abe66d460f0d00612652","api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/group/all/ \\\n-H \"Content-Type: application/json\""},{"language":"php","code":"<?php\n    error_reporting(E_ALL);\n    ini_set(\"display_errors\", 1);\n\n    $username = '[[app:username]]';\n    $api_key = '[[app:key]]';\n    $response_type = 'json';\n\n    // Build and make API call\n    $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/group/all/';\n    $curl_handle = curl_init();\n    curl_setopt($curl_handle, CURLOPT_URL, $url);\n    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POST, FALSE);\n    curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n    $response = curl_exec($curl_handle);\n    curl_close($curl_handle);\n\n    echo($response);\n\n    // Example parsing of JSON response\n    if(strtolower($response_type) == 'json')\n    {\n        // Decode response to array\n        $response = json_decode($response, TRUE);\n\n        if(isset($response['response']) && $response['response']['code'] == '200')\n        {\n            // Loop through and output group ids\n            if(isset($response['response']['data']['groups']))\n            {\n                foreach($response['response']['data']['groups'] as $ary => $response_row)\n                {\n                    echo \"Group ID: \".$response_row['group_id'].\"\\n\\n\";\n                }\n            }\n        } else {\n            echo 'Error, see response dump above.';\n        }\n    }\n?>\n "}]},"method":"get","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"response\":{\n    \"code\":\"200\",\n    \"message\":\"OK: The request was successful. See response body for additional data.\",\n    \"data\":{\n        \"groups\": [\n          \"group\":{\n            \"group_id:\"1\"\n            \"name\":\"Sample\",\n            \"description\":\"Sample group description\",\n            \"default\":\"0\",\n            \"total_ambassadors\": 5\n          },\n          \"group\":{\n            \"group_id:\"2\"\n            \"name\":\"Test\",\n            \"description\":\"Test group description\",\n            \"default\":\"0\",\n          \t\"total_ambassadors\": 100\n          },\n          \"group\":{\n            \"group_id:\"3\"\n            \"name\":\"New\",\n            \"description\":\"New group description\",\n            \"default\":\"0\",\n          \t\"total_ambassadors\": 0\n          }\n        ]\n    }\n  }\n}","name":""}]},"settings":"","url":"/group/all/"},"childrenPages":[]}

get/group/all/

Retrieves a list of and details about your company's groups.


User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"56e1b00c71e22d2b0098020a","excerpt":"Retrieves details about a given group and a list of up to 100 ambassadors.","isReference":true,"link_external":false,"link_url":"","order":15,"project":"5634abe66d460f0d0061264f","__v":0,"editedParams":true,"editedParams2":true,"slug":"groupget","title":"/group/get/","version":"5634abe66d460f0d00612652","body":"","createdAt":"2016-03-10T17:34:04.093Z","hidden":false,"parentDoc":null,"updates":[],"user":"56ddedf5502b132000191327","category":"56464ea136961e0d005c61a5","api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/group/get/ \\\n-H \"Content-Type: application/json\" \\\n-d '{\"group_id\": 1}' \\\n-X POST"},{"language":"php","code":"<?php\n    error_reporting(E_ALL);\n    ini_set(\"display_errors\", 1);\n\n    $username = '[[app:username]]';\n    $api_key = '[[app:key]]';\n    $response_type = 'json';\n\n    // Build and make API call\n    $data = array('group_id' => '1',\n                'page' => '1');\n    $data = http_build_query($data);\n    $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/group/get/';\n    $curl_handle = curl_init();\n    curl_setopt($curl_handle, CURLOPT_URL, $url);\n    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POST, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);\n    curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n    $response = curl_exec($curl_handle);\n    curl_close($curl_handle);\n\n    echo($response);\n\n    // Example parsing of JSON response\n    if(strtolower($response_type) == 'json')\n    {\n        // Decode response to array\n        $response = json_decode($response, TRUE);\n\n        if(isset($response['response']) && $response['response']['code'] == '200')\n        {\n            // Loop through and output ambassadors belonging to group\n            if(isset($response['response']['data']['ambassadors']))\n            {\n                foreach($response['response']['data']['ambassadors'] as $response_field => $response_data)\n                {\n                    echo $response_field.\" = \".$response_data.\"\\n\\n\";\n                }\n            }\n        } else {\n            echo 'Error, see response dump above.';\n        }\n    }\n?>\n "}]},"method":"post","params":[{"ref":"","required":false,"type":"int","in":"body","_id":"56e1b00c71e22d2b0098020c","default":"","desc":"Group Id listed on your groups page","name":"group_id"},{"required":false,"desc":"Page number of paginated results","default":"","type":"int","name":"page","in":"body","_id":"56e1b00c71e22d2b0098020b","ref":""}],"results":{"codes":[{"name":"","code":"{\n  \"response\":{\n    \"code\":\"200\",\n    \"message\":\"OK: The request was successful. See response body for additional data.\",\n    \"data\":{\n      \"group\":{\n        \"group_id:\"1\"\n        \"name\":\"Sample\",\n        \"description\":\"Sample group description\",\n        \"default\":\"0\",\n      },\n      \"ambassadors\": [\n          {\"email\":\"jane@example.com\"},\n          {\"email\":\"joe@example.com\"},\n          {\"email\":\"josh@example.com\"},\n          {\"email\":\"jeff@example.com\"},\n          {\"email\":\"jack@example.com\"}\n      ]\n    }\n  }\n}","language":"json","status":200},{"status":400,"name":"","code":"{\n  \"response\": {\n    \"code\": \"400\",\n    \"message\": \"BAD REQUEST: The parameters provided were invalid. See response body for error messages.\",\n    \"errors\": {\n      \"error\": [\n        \"The following GET/POST parameters are not numbers. \\\"page\\\", \\\"group_id\\\".\"\n      ]\n    }\n  }\n}","language":"json"}]},"settings":"","url":"/group/get/"},"githubsync":"","sync_unique":"","type":"post","childrenPages":[]}

post/group/get/

Retrieves details about a given group and a list of up to 100 ambassadors.

Body Params

group_id:
integer
Group Id listed on your groups page
page:
integer
Page number of paginated results

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"56e1b271d2f9771900df1cc6","updates":["5878649c8671860f0093be61","58e64b66701bd123006fa967"],"category":"56464ea136961e0d005c61a5","editedParams":true,"excerpt":"Retrieves up to 100 commissions meeting the provided thresholds","githubsync":"","isReference":true,"type":"post","version":"5634abe66d460f0d00612652","api":{"params":[{"type":"int","name":"page","_id":"56e1b3d9c5a3542b001aab26","ref":"","in":"body","required":false,"desc":"Page number of paginated results","default":"1"},{"desc":"Your customer's email address","default":"0","type":"string","name":"email","_id":"56e1b3d9c5a3542b001aab25","ref":"","in":"body","required":false},{"name":"uid","_id":"56e1b3d9c5a3542b001aab24","ref":"","in":"body","required":false,"desc":"Your customer's internal unique ID","default":"0","type":"string"},{"required":false,"type":"string","_id":"56e1b3d9c5a3542b001aab23","default":"","desc":"When variable is not used all commissions are returned (0 - Returns only pending commissions, 1 - Returns only approved commissions,  2 - Returns only denied commissions )","in":"body","name":"is_approved","ref":""},{"desc":"When variable is not used all commissions are returned (1 - Returns only sandbox commissions, 0 - Returns only production commissions)","default":"","type":"string","name":"sandbox","_id":"56e1b3d9c5a3542b001aab22","ref":"","in":"body","required":false},{"_id":"57f3ce7049298517009bcc3c","ref":"","in":"body","required":false,"desc":"When variable is not used all commissions are returned (1 - Returns only commissions that are welcome bonuses, 0 - Returns commissions that are not welcome bonuses)","default":"","type":"string","name":"is_welcome_bonus"},{"type":"string","_id":"57f3ce7049298517009bcc3b","default":"","desc":"Filter by commissions created before the date provided.  Note: The date provided is treated as midnight of the date provided.","in":"body","name":"created_at__lte","ref":"","required":false},{"default":"","desc":"Filter by ambassadors created on or after the date provided. Note: The date provided is treated as midnight of the date provided.","in":"body","name":"created_at__gte","ref":"","required":false,"type":"string","_id":"57f3ce7049298517009bcc3a"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"response\": {\n    \"code\": \"200\",\n    \"message\": \"OK: The request was successful. See response body for additional data.\",\n    \"data\": {\n      \"commissions\": [\n        {\n          \"commission_uid\": \"4813\",\n          \"campaign_uid\": \"260\",\n          \"affiliate_uid\": \"17080\",\n          \"referring_uid\": \"15056\",\n          \"remote_customer_email\": \"john@example.com\",\n          \"remote_customer_id\": \"12345\",\n          \"affiliate_email\": \"jane@example.com\",\n          \"affiliate_first_name\": \"Jane\",\n          \"affiliate_last_name\": \"Doe\",\n          \"revenue_amount\": \"150.00\",\n          \"commission_amount\": \"50.00\",\n          \"created_at\": \"2013-04-08 13:51:44.731\",\n          \"transaction_id\": null,\n          \"is_approved\": \"1\",\n          \"is_sandbox\": \"0\",\n          \"is_trial\": \"0\",\n          \"event_data1\": null,\n          \"event_data2\": null,\n          \"event_data3\": null,\n          \"is_welcome_bonus\": \"0\",\n          \"fraud\": {\n            \"status\": passed,\n            \"score\": 0,\n            \"reasons\": []\n          }\n        },\n        {\n          \"commission_uid\": \"4814\",\n          \"campaign_uid\": \"260\",\n          \"affiliate_uid\": \"17080\",\n          \"referring_uid\": \"15056\",\n          \"remote_customer_email\": \"john@example.com\",\n          \"remote_customer_id\": \"12345\",\n          \"affiliate_email\": \"jane@example.com\",\n          \"affiliate_first_name\": \"Jane\",\n          \"affiliate_last_name\": \"Doe\",\n          \"revenue_amount\": \"45.00\",\n          \"commission_amount\": \"5.00\",\n          \"created_at\": \"2013-04-08 16:51:44.842\",\n          \"transaction_id\": null,\n          \"is_approved\": \"0\",\n          \"is_sandbox\": \"0\",\n          \"is_trial\": \"0\",\n          \"event_data1\": null,\n          \"event_data2\": null,\n          \"event_data3\": null,\n          \"is_welcome_bonus\": \"1\",\n          \"fraud\": {\n            \"status\": scanning,\n            \"score\": 0,\n            \"reasons\": []\n          }\n        },\n        {\n          \"commission_uid\": \"821\",\n          \"campaign_uid\": \"95\",\n          \"affiliate_uid\": \"4364\",\n          \"referring_uid\": \"4349\",\n          \"remote_customer_email\": \"elmer@example.com\",\n          \"remote_customer_id\": null,\n          \"affiliate_email\": \"willie@example.com\",\n          \"affiliate_first_name\": \"\",\n          \"affiliate_last_name\": \"\",\n          \"revenue_amount\": \"15.28\",\n          \"commission_amount\": \"62.00\",\n          \"created_at\": \"2012-04-10 17:43:19.522\",\n          \"transaction_id\": \"324543\",\n          \"is_approved\": \"0\",\n          \"is_sandbox\": \"0\",\n          \"is_trial\": \"0\",\n          \"event_data1\": \"testingthisagain2\",\n          \"event_data2\": null,\n          \"event_data3\": null,\n          \"is_welcome_bonus\": \"0\",\n          \"fraud\": {\n            \"status\": \"fraudulent\",\n            \"score\": 94.41,\n            \"reasons\": [\n            \t\"The referred ambassador has the same device as a currently banned ambassdor.\",\n              \"The referring ambassador for this commission has 21 other denied commissions.\"\n            ]\n          }\n        }\n      ]\n    }\n  }\n}","name":""}]},"settings":"","url":"/commission/all/","auth":"required","examples":{"codes":[{"code":"curl https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/commission/all/ \\\n-H \"Content-Type: application/json\" \\\n-d '{\"email\": \"johndoe@example.com\"}' \\\n-X POST","language":"curl"},{"code":"<?php\n    error_reporting(E_ALL);\n    ini_set(\"display_errors\", 1);\n\n    $username = '[[app:username]]';\n    $api_key = '[[app:key]]';\n    $response_type = 'json';\n\n    // Build and make API call\n    $data = array('page' => '1');\n    $data = http_build_query($data);\n    $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/commission/all/';\n    $curl_handle = curl_init();\n    curl_setopt($curl_handle, CURLOPT_URL, $url);\n    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POST, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);\n    curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n    $response = curl_exec($curl_handle);\n    curl_close($curl_handle);\n\n    echo($response);\n\n    // Example parsing of JSON response\n    if(strtolower($response_type) == 'json')\n    {\n        // Decode response to array\n        $response = json_decode($response, TRUE);\n\n        if(isset($response['response']) && $response['response']['code'] == '200')\n        {\n            // Loop through and output ambassadors\n            if(isset($response['response']['data']['ambassadors']))\n            {\n                foreach($response['response']['data']['ambassadors'] as $ary => $response_row)\n                {\n                    echo \"Ambassador: \".$response_row['email'].\"\\n\\n\";\n                }\n            }\n        } else {\n            echo 'Error, see response dump above.';\n        }\n    }\n?>","language":"php"}]},"method":"post"},"editedParams2":true,"link_url":"","order":16,"sync_unique":"","title":"/commission/all/","user":"56ddedf5502b132000191327","__v":5,"body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Fraud Status\",\n  \"body\": \"The Fraud Status is available for every commission in the response.  Each commission is assigned a status, score, and reasons if any.  The fraud score is the percent of suspiciousness out of 100. \\n\\nThe possible Fraud Status values in the response are:\\n * __Flagged__ - commission has been marked suspicious\\n * __Fraudulent__ - was flagged, and the company has denied the commission\\n * __Immune__ - has been unflagged and marked immune\\n * __Null__\\n * __Passed__ - the commission passed fraud detection, it's not suspicious\\n * __Scanning__ - the commission is being analyzed for fraud\\n * __Unflagged__ - was flagged, but has been unflagged by the company\"\n}\n[/block]","next":{"description":"","pages":[]},"parentDoc":null,"project":"5634abe66d460f0d0061264f","slug":"commissionall","createdAt":"2016-03-10T17:44:17.667Z","hidden":false,"link_external":false,"childrenPages":[]}

post/commission/all/

Retrieves up to 100 commissions meeting the provided thresholds

Body Params

page:
integer1
Page number of paginated results
email:
string0
Your customer's email address
uid:
string0
Your customer's internal unique ID
is_approved:
string
When variable is not used all commissions are returned (0 - Returns only pending commissions, 1 - Returns only approved commissions, 2 - Returns only denied commissions )
sandbox:
string
When variable is not used all commissions are returned (1 - Returns only sandbox commissions, 0 - Returns only production commissions)
is_welcome_bonus:
string
When variable is not used all commissions are returned (1 - Returns only commissions that are welcome bonuses, 0 - Returns commissions that are not welcome bonuses)
created_at__lte:
string
Filter by commissions created before the date provided. Note: The date provided is treated as midnight of the date provided.
created_at__gte:
string
Filter by ambassadors created on or after the date provided. Note: The date provided is treated as midnight of the date provided.
[block:callout] { "type": "info", "title": "Fraud Status", "body": "The Fraud Status is available for every commission in the response. Each commission is assigned a status, score, and reasons if any. The fraud score is the percent of suspiciousness out of 100. \n\nThe possible Fraud Status values in the response are:\n * __Flagged__ - commission has been marked suspicious\n * __Fraudulent__ - was flagged, and the company has denied the commission\n * __Immune__ - has been unflagged and marked immune\n * __Null__\n * __Passed__ - the commission passed fraud detection, it's not suspicious\n * __Scanning__ - the commission is being analyzed for fraud\n * __Unflagged__ - was flagged, but has been unflagged by the company" } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



[block:callout] { "type": "info", "title": "Fraud Status", "body": "The Fraud Status is available for every commission in the response. Each commission is assigned a status, score, and reasons if any. The fraud score is the percent of suspiciousness out of 100. \n\nThe possible Fraud Status values in the response are:\n * __Flagged__ - commission has been marked suspicious\n * __Fraudulent__ - was flagged, and the company has denied the commission\n * __Immune__ - has been unflagged and marked immune\n * __Null__\n * __Passed__ - the commission passed fraud detection, it's not suspicious\n * __Scanning__ - the commission is being analyzed for fraud\n * __Unflagged__ - was flagged, but has been unflagged by the company" } [/block]
{"_id":"56e1b65a06fe670e003f96a4","createdAt":"2016-03-10T18:00:58.453Z","hidden":false,"order":17,"__v":3,"body":"","category":"56464ea136961e0d005c61a5","slug":"commissionupdate","version":"5634abe66d460f0d00612652","githubsync":"","isReference":true,"next":{"description":"","pages":[]},"title":"/commission/update/","updates":[],"editedParams":true,"editedParams2":true,"excerpt":"Updates the commission status. If a commission is pending \"0\", it can be changed to approved \"1\" or denied \"2\". Approved and denied commissions cannot be updated via API.\n\nNOTE: To identify a commission in our system you can choose either 'commission_uid' (you can get it using commission/all method) or 'transaction_uid'. If both are used then 'commission_uid' takes precedence. To make sure you will update just one commission with given transaction uid, you can send additional parameter: campaign_uid.","link_external":false,"link_url":"","parentDoc":null,"project":"5634abe66d460f0d0061264f","sync_unique":"","api":{"examples":{"codes":[{"code":"curl https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/commission/update/ \\\n-H \"Content-Type: application\\json\"\n-d '{\"commission_uid\":\"400\", \"is_approved\":\"1\"}' \\\n-X POST\n","language":"curl"},{"code":"<?php\n    error_reporting(E_ALL);\n    ini_set(\"display_errors\", 1);\n\n    $username = '[[app:username]]';\n    $api_key = '[[app:key]]';\n    $response_type = 'json';\n\n    // Build and make API call\n    $data = array('commission_uid' => '4813',\n                'is_approved' => '1');\n    $data = http_build_query($data);\n    $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/commission/update/';\n    $curl_handle = curl_init();\n    curl_setopt($curl_handle, CURLOPT_URL, $url);\n    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POST, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);\n    curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n    $response = curl_exec($curl_handle);\n    curl_close($curl_handle);\n\n    echo($response);\n\n    // Example parsing of JSON response\n    if(strtolower($response_type) == 'json')\n    {\n        // Decode response to array\n        $response = json_decode($response, TRUE);\n\n        var_dump($response);\n    }\n?>","language":"php"}]},"method":"get","params":[{"ref":"","required":true,"desc":"UID of commission (see note above)","default":"","type":"string","name":"commission_uid","in":"query","_id":"56e1c1df36b3bb3400cd0b00"},{"required":true,"desc":"Unique transaction ID for the commission (see note above)","default":"","type":"string","name":"transaction_uid","in":"query","_id":"56e1c1df36b3bb3400cd0aff","ref":""},{"default":"","type":"string","name":"campaign_uid","in":"query","_id":"56e1c1df36b3bb3400cd0afe","ref":"","required":false,"desc":"You can use it when you identify commission by transaction_uid to make sure you will update just one commission with given transaction uid"},{"type":"string","_id":"56e1c1df36b3bb3400cd0afd","default":"","desc":"1 - approved commission, 2 - deny commission","in":"query","name":"is_approved","ref":"","required":false},{"name":"event_data1","in":"query","_id":"56e1c1df36b3bb3400cd0afc","ref":"","required":false,"desc":"Custom field - related to event/commission","default":"","type":"string"},{"desc":"Custom field - related to event/commission","default":"","type":"string","name":"event_data2","in":"query","_id":"56e1c1df36b3bb3400cd0afb","ref":"","required":false},{"name":"event_data3","in":"query","_id":"56e1c1df36b3bb3400cd0afa","ref":"","required":false,"desc":"Custom field - related to event/commission","default":"","type":"string"},{"desc":"The revenue amount","default":"","type":"string","name":"revenue","in":"query","_id":"5751ed2f7b01730e00c28e16","ref":"","required":false}],"results":{"codes":[{"name":"","status":200,"language":"json","code":"{\n  \"response\": {\n    \"code\": \"200\",\n    \"message\": \"OK: The request was successful. See response body for additional data.\",\n    \"data\": {\n      \"message\": \"Commission updated successfully.\"\n    }\n  }\n}"},{"status":400,"language":"json","code":"{\n  \"response\": {\n    \"code\": \"400\",\n    \"message\": \"BAD REQUEST: The parameters provided were invalid. See response body for error messages.\",\n    \"errors\": {\n      \"error\": [\n        \"The following GET/POST parameter is required: commission_uid or transaction_uid.\"\n      ]\n    }\n  }\n}","name":""},{"status":400,"language":"json","code":"{\n  \"response\": {\n    \"code\": \"400\",\n    \"message\": \"BAD REQUEST: The parameters provided were invalid. See response body for error messages.\",\n    \"errors\": {\n      \"error\": [\n        \"You can change state of pending commission only.\"\n      ]\n    }\n  }\n}"}]},"settings":"","url":"/commission/update/","auth":"required"},"user":"56ddedf5502b132000191327","type":"get","childrenPages":[]}

get/commission/update/

Updates the commission status. If a commission is pending "0", it can be changed to approved "1" or denied "2". Approved and denied commissions cannot be updated via API. NOTE: To identify a commission in our system you can choose either 'commission_uid' (you can get it using commission/all method) or 'transaction_uid'. If both are used then 'commission_uid' takes precedence. To make sure you will update just one commission with given transaction uid, you can send additional parameter: campaign_uid.

Query Params

commission_uid:
required
string
UID of commission (see note above)
transaction_uid:
required
string
Unique transaction ID for the commission (see note above)
campaign_uid:
string
You can use it when you identify commission by transaction_uid to make sure you will update just one commission with given transaction uid
is_approved:
string
1 - approved commission, 2 - deny commission
event_data1:
string
Custom field - related to event/commission
event_data2:
string
Custom field - related to event/commission
event_data3:
string
Custom field - related to event/commission
revenue:
string
The revenue amount

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"56e1c21d150ed52d0062c67f","createdAt":"2016-03-10T18:51:09.676Z","editedParams2":true,"slug":"commissionadd","title":"/commission/add/","type":"post","updates":[],"api":{"method":"post","params":[{"ref":"","required":true,"type":"string","in":"body","_id":"56e1c4174241650e005b7cb3","default":"","desc":"Your ambassador's internal unique ID (see note above)","name":"uid"},{"in":"body","_id":"56e1c4174241650e005b7cb2","default":"","desc":"Your ambassador's email address (see note above)","name":"email","ref":"","required":true,"type":"string"},{"default":"","desc":"Your campaign's ID","name":"campaign_uid","ref":"","required":true,"type":"string","in":"body","_id":"56e1c4174241650e005b7cb1"},{"required":true,"type":"double","in":"body","_id":"56e1c4174241650e005b7cb0","default":"","desc":"Amount of commission","name":"amount","ref":""},{"required":false,"desc":"Your customer's email address","default":"","type":"string","name":"customer_email","in":"body","_id":"56e1c4174241650e005b7caf","ref":""},{"default":"","type":"string","name":"first_name","in":"body","_id":"56e1c4174241650e005b7cae","ref":"","required":false,"desc":"Your customer's first name"},{"in":"body","_id":"56e1c4174241650e005b7cad","ref":"","required":false,"desc":"Your customer's last name","default":"","type":"string","name":"last_name"},{"ref":"","required":false,"desc":"Revenue amount of commission","default":"0","type":"double","name":"revenue","in":"body","_id":"56e1c4174241650e005b7cac"},{"type":"string","name":"transaction_uid","in":"body","_id":"56e1c4174241650e005b7cab","ref":"","required":false,"desc":"Unique transaction ID for commission","default":""},{"type":"string","name":"referrer_uid","in":"body","_id":"56e1c4174241650e005b7caa","ref":"","required":false,"desc":"Your referrer's internal unique ID","default":""},{"required":false,"desc":"Your customer's internal unique ID","default":"","type":"string","name":"customer_uid","in":"body","_id":"56e1c4174241650e005b7ca9","ref":""},{"name":"is_approved","ref":"","required":false,"type":"string","in":"body","_id":"56e1c4174241650e005b7ca8","default":"0","desc":"1- approved commission, 0 - pending commission"},{"default":"1","desc":"Email login credentials to new ambassadors (1 - yes, 0 - no)","name":"email_new_ambassador","ref":"","required":false,"type":"string","in":"body","_id":"56e1c4174241650e005b7ca7"},{"desc":"New ambassadors create are deactivated (1 - yes, 0 - no)","name":"deactivate_new_ambassador","ref":"","required":false,"type":"string","in":"body","_id":"56e1c4174241650e005b7ca6","default":"0"},{"desc":"Custom field - related to event/commission","default":"","type":"string","name":"event_data1","in":"body","_id":"56e1c4174241650e005b7ca5","ref":"","required":false},{"name":"event_data2","in":"body","_id":"56e1c4174241650e005b7ca4","ref":"","required":false,"desc":"Custom field - related to event/commission","default":"","type":"string"},{"default":"","type":"string","name":"event_data3","in":"body","_id":"56e1c4174241650e005b7ca3","ref":"","required":false,"desc":"Custom field - related to event/commission"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"response\": {\n    \"code\": \"200\",\n    \"message\": \"OK: The request was successful. See response body for additional data.\",\n    \"data\": {\n      \"message\": \"Commission added successfully.\",\n      \"commission_uid\": 1234,\n      \"campaign_uid\": 230\n    }\n  }\n}","name":""},{"status":400,"language":"json","code":"{\n  \"response\": {\n    \"code\": \"400\",\n    \"message\": \"BAD REQUEST: The parameters provided were invalid. See response body for error messages.\",\n    \"errors\": {\n      \"error\": [\n        \"The following GET/POST parameter is required: uid or email.\"\n      ]\n    }\n  }\n}","name":""},{"code":"{\n  \"response\": {\n    \"code\": \"400\",\n    \"message\": \"BAD REQUEST: The parameters provided were invalid. See response body for error messages.\",\n    \"errors\": {\n      \"error\": [\n        \"Invalid campaign_uid.\"\n      ]\n    }\n  }\n}","language":"text","status":400}]},"settings":"","url":"/commission/add/","auth":"required","examples":{"codes":[{"language":"curl","code":"curl https://getambassador.com/api/v2/[[app:username]]/[[app:key]]/json/commission/add/ \\\n-H \"Content-Type: application/json\" \\\n-d '{\"email\": \"johndoe@example.com\", \"campaign_uid\": \"\", \"amount\": 1.00 }' \\\n-X POST"},{"language":"php","code":"<?php\n    error_reporting(E_ALL);\n    ini_set(\"display_errors\", 1);\n\n    $username = '[[app:username]]';\n    $api_key = '[[app:key]]';\n    $response_type = 'json';\n\n    // Build and make API call\n    $data = array('email' => 'email@example.com',\n                'campaign_uid' => '260',\n                'amount' => '15',\n                'is_approved' => '1');\n    $data = http_build_query($data);\n    $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/commission/add/';\n    $curl_handle = curl_init();\n    curl_setopt($curl_handle, CURLOPT_URL, $url);\n    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POST, TRUE);\n    curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $data);\n    curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n    $response = curl_exec($curl_handle);\n    curl_close($curl_handle);\n\n    echo($response);\n\n    // Example parsing of JSON response\n    if(strtolower($response_type) == 'json')\n    {\n        // Decode response to array\n        $response = json_decode($response, TRUE);\n\n        var_dump($response);\n    }\n?>\n "}]}},"editedParams":true,"sync_unique":"","user":"56ddedf5502b132000191327","body":"","category":"56464ea136961e0d005c61a5","isReference":true,"link_external":false,"order":18,"parentDoc":null,"__v":3,"excerpt":"Creates commission for given ambassador. Useful for commission events without referrers. For commissions with a referred party, use the event/record method.\nNOTE: To identify ambassador in our system you can choose either 'uid' or 'email'. If both are used then 'uid' takes precedence.","githubsync":"","hidden":false,"link_url":"","project":"5634abe66d460f0d0061264f","version":"5634abe66d460f0d00612652","childrenPages":[]}

post/commission/add/

Creates commission for given ambassador. Useful for commission events without referrers. For commissions with a referred party, use the event/record method. NOTE: To identify ambassador in our system you can choose either 'uid' or 'email'. If both are used then 'uid' takes precedence.

Body Params

uid:
required
string
Your ambassador's internal unique ID (see note above)
email:
required
string
Your ambassador's email address (see note above)
campaign_uid:
required
string
Your campaign's ID
amount:
required
double
Amount of commission
customer_email:
string
Your customer's email address
first_name:
string
Your customer's first name
last_name:
string
Your customer's last name
revenue:
double0
Revenue amount of commission
transaction_uid:
string
Unique transaction ID for commission
referrer_uid:
string
Your referrer's internal unique ID
customer_uid:
string
Your customer's internal unique ID
is_approved:
string0
1- approved commission, 0 - pending commission
email_new_ambassador:
string1
Email login credentials to new ambassadors (1 - yes, 0 - no)
deactivate_new_ambassador:
string0
New ambassadors create are deactivated (1 - yes, 0 - no)
event_data1:
string
Custom field - related to event/commission
event_data2:
string
Custom field - related to event/commission
event_data3:
string
Custom field - related to event/commission

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"5898ebc2c9430c1b0089a24d","parentDoc":null,"type":"basic","__v":0,"excerpt":"","githubsync":"","hidden":false,"updates":[],"user":"5634abcb8b86331700b48916","next":{"pages":[],"description":""},"project":"5634abe66d460f0d0061264f","slug":"webhooks","sync_unique":"","link_url":"","order":0,"title":"Overview","version":"5634abe66d460f0d00612652","body":"A webhook is a callback over HTTP that you can configure to be notified about certain events in your Ambassador account.\n\nUsing webhooks can open up many possibilities for more advanced integrations with Ambassador. For example, you can set up a webhook to hit your application whenever a contact is created and send them additional resources, add them to your data store, etc.\n\nTo set up a webhook, contact support@getambassador.com or your success coach.\n\nTo receive a webhook, you will need a publicly accessible URL.  When a given event occurs, such as creating a new contact, we will make a POST request to the URL of your choice with JSON data.\n\nThe basic format of a webhook response is as follows:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"webhook_version\\\": 0.1,\\n    \\\"created_at\\\": \\\"2012-01-19T18:55:10\\\",\\n    \\\"event_id\\\": 123,\\n    \\\"event_type\\\": \\\"contact-created\\\",\\n    \\\"event_data\\\": {\\n    \\t\\\"contact\\\": {\\n            \\\"id\\\": 100,\\n            \\\"first_name\\\": \\\"First\\\",\\n            \\\"last_name\\\": \\\"Last\\\",\\n            \\\"email\\\": \\\"email@example.com\\\",\\n            \\\"test_mode\\\": false,\\n            \\\"created_at\\\": \\\"2012-01-19T18:55:10\\\",\\n            \\\"enrolled_at\\\": \\\"2015-09-16T21:30:49.710\\\",\\n            \\\"unenrolled_at\\\": \\\"2016-10-12T12:01:22.239\\\",\\n            \\\"status\\\": \\\"enrolled\\\",\\n            \\\"internal_id\\\": \\\"your-company-contact-id\\\",\\n            \\\"phone\\\": \\\"555.555.5555\\\",\\n            \\\"company\\\": \\\"Ambassador\\\",\\n            \\\"job_title\\\": \\\"Developer\\\",\\n            \\\"street\\\": \\\"1 Main Street\\\",\\n            \\\"city\\\": \\\"Springfield\\\",\\n            \\\"state\\\": \\\"Michigan\\\",\\n            \\\"zip\\\": \\\"48000\\\",\\n            \\\"country\\\": \\\"United States\\\"\\n        }\\n    }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nThe `event_data` field contains different data based on the `event_type`. The following table outlines all of the event types available to you, what their `event_type` value will be, and when they occur.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Event\",\n    \"h-1\": \"Event Type\",\n    \"h-2\": \"Occurs When\",\n    \"0-0\": \"Contact Created\",\n    \"0-1\": \"contact-created\",\n    \"0-2\": \"A new contact is created\",\n    \"1-0\": \"Contact Status Updated\",\n    \"1-1\": \"contact-status-updated\",\n    \"1-2\": \"A contact's status is updated e.g. enrolled, banned, or unsubscribed\",\n    \"2-0\": \"Commission Created\",\n    \"2-1\": \"commission-created\",\n    \"2-2\": \"A new commission is created\",\n    \"3-0\": \"Commission Status Updated\",\n    \"3-1\": \"commission-status-updated\",\n    \"3-2\": \"A commission status is updated e.g. approved or denied\",\n    \"h-3\": \"\",\n    \"4-0\": \"Payout Created\",\n    \"4-1\": \"payout-created\",\n    \"4-2\": \"A new payout is created\",\n    \"5-0\": \"Share Tracked\",\n    \"5-1\": \"share-tracked\",\n    \"5-2\": \"A share is tracked\",\n    \"6-0\": \"Click Tracked\",\n    \"6-1\": \"click-tracked\",\n    \"6-2\": \"A click is tracked\",\n    \"7-2\": \"One contact refers another\",\n    \"7-1\": \"referral-created\",\n    \"7-0\": \"Referral created\",\n    \"8-0\": \"Contact Added to Campaign\",\n    \"8-1\": \"contact-added-to-campaign\",\n    \"8-2\": \"Contact joins a campaign\",\n    \"9-1\": \"contact-added-to-segment\",\n    \"9-0\": \"Contact Added to Segment\",\n    \"9-2\": \"Contact is added to a segment\"\n  },\n  \"cols\": 3,\n  \"rows\": 10\n}\n[/block]","isReference":true,"link_external":false,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"category":"5898ea852f65061b002c8712","createdAt":"2017-02-06T21:33:54.909Z","childrenPages":[]}

Overview


A webhook is a callback over HTTP that you can configure to be notified about certain events in your Ambassador account. Using webhooks can open up many possibilities for more advanced integrations with Ambassador. For example, you can set up a webhook to hit your application whenever a contact is created and send them additional resources, add them to your data store, etc. To set up a webhook, contact support@getambassador.com or your success coach. To receive a webhook, you will need a publicly accessible URL. When a given event occurs, such as creating a new contact, we will make a POST request to the URL of your choice with JSON data. The basic format of a webhook response is as follows: [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"event_id\": 123,\n \"event_type\": \"contact-created\",\n \"event_data\": {\n \t\"contact\": {\n \"id\": 100,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email@example.com\",\n \"test_mode\": false,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"enrolled_at\": \"2015-09-16T21:30:49.710\",\n \"unenrolled_at\": \"2016-10-12T12:01:22.239\",\n \"status\": \"enrolled\",\n \"internal_id\": \"your-company-contact-id\",\n \"phone\": \"555.555.5555\",\n \"company\": \"Ambassador\",\n \"job_title\": \"Developer\",\n \"street\": \"1 Main Street\",\n \"city\": \"Springfield\",\n \"state\": \"Michigan\",\n \"zip\": \"48000\",\n \"country\": \"United States\"\n }\n }\n}", "language": "json" } ] } [/block] The `event_data` field contains different data based on the `event_type`. The following table outlines all of the event types available to you, what their `event_type` value will be, and when they occur. [block:parameters] { "data": { "h-0": "Event", "h-1": "Event Type", "h-2": "Occurs When", "0-0": "Contact Created", "0-1": "contact-created", "0-2": "A new contact is created", "1-0": "Contact Status Updated", "1-1": "contact-status-updated", "1-2": "A contact's status is updated e.g. enrolled, banned, or unsubscribed", "2-0": "Commission Created", "2-1": "commission-created", "2-2": "A new commission is created", "3-0": "Commission Status Updated", "3-1": "commission-status-updated", "3-2": "A commission status is updated e.g. approved or denied", "h-3": "", "4-0": "Payout Created", "4-1": "payout-created", "4-2": "A new payout is created", "5-0": "Share Tracked", "5-1": "share-tracked", "5-2": "A share is tracked", "6-0": "Click Tracked", "6-1": "click-tracked", "6-2": "A click is tracked", "7-2": "One contact refers another", "7-1": "referral-created", "7-0": "Referral created", "8-0": "Contact Added to Campaign", "8-1": "contact-added-to-campaign", "8-2": "Contact joins a campaign", "9-1": "contact-added-to-segment", "9-0": "Contact Added to Segment", "9-2": "Contact is added to a segment" }, "cols": 3, "rows": 10 } [/block]
A webhook is a callback over HTTP that you can configure to be notified about certain events in your Ambassador account. Using webhooks can open up many possibilities for more advanced integrations with Ambassador. For example, you can set up a webhook to hit your application whenever a contact is created and send them additional resources, add them to your data store, etc. To set up a webhook, contact support@getambassador.com or your success coach. To receive a webhook, you will need a publicly accessible URL. When a given event occurs, such as creating a new contact, we will make a POST request to the URL of your choice with JSON data. The basic format of a webhook response is as follows: [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"event_id\": 123,\n \"event_type\": \"contact-created\",\n \"event_data\": {\n \t\"contact\": {\n \"id\": 100,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email@example.com\",\n \"test_mode\": false,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"enrolled_at\": \"2015-09-16T21:30:49.710\",\n \"unenrolled_at\": \"2016-10-12T12:01:22.239\",\n \"status\": \"enrolled\",\n \"internal_id\": \"your-company-contact-id\",\n \"phone\": \"555.555.5555\",\n \"company\": \"Ambassador\",\n \"job_title\": \"Developer\",\n \"street\": \"1 Main Street\",\n \"city\": \"Springfield\",\n \"state\": \"Michigan\",\n \"zip\": \"48000\",\n \"country\": \"United States\"\n }\n }\n}", "language": "json" } ] } [/block] The `event_data` field contains different data based on the `event_type`. The following table outlines all of the event types available to you, what their `event_type` value will be, and when they occur. [block:parameters] { "data": { "h-0": "Event", "h-1": "Event Type", "h-2": "Occurs When", "0-0": "Contact Created", "0-1": "contact-created", "0-2": "A new contact is created", "1-0": "Contact Status Updated", "1-1": "contact-status-updated", "1-2": "A contact's status is updated e.g. enrolled, banned, or unsubscribed", "2-0": "Commission Created", "2-1": "commission-created", "2-2": "A new commission is created", "3-0": "Commission Status Updated", "3-1": "commission-status-updated", "3-2": "A commission status is updated e.g. approved or denied", "h-3": "", "4-0": "Payout Created", "4-1": "payout-created", "4-2": "A new payout is created", "5-0": "Share Tracked", "5-1": "share-tracked", "5-2": "A share is tracked", "6-0": "Click Tracked", "6-1": "click-tracked", "6-2": "A click is tracked", "7-2": "One contact refers another", "7-1": "referral-created", "7-0": "Referral created", "8-0": "Contact Added to Campaign", "8-1": "contact-added-to-campaign", "8-2": "Contact joins a campaign", "9-1": "contact-added-to-segment", "9-0": "Contact Added to Segment", "9-2": "Contact is added to a segment" }, "cols": 3, "rows": 10 } [/block]
{"_id":"5898ef3f2f65061b002c8730","title":"Security","version":"5634abe66d460f0d00612652","category":"5898ea852f65061b002c8712","createdAt":"2017-02-06T21:48:47.380Z","excerpt":"","next":{"pages":[],"description":""},"parentDoc":null,"__v":0,"hidden":false,"isReference":true,"order":1,"link_external":false,"link_url":"","project":"5634abe66d460f0d0061264f","type":"basic","api":{"settings":"","auth":"required","params":[],"url":"","results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"status":400,"language":"json","code":"{}","name":""}]}},"body":"Because you receive webhooks via a publicly accessible URL, it is important that you verify your webhooks are genuine. Each webhook you configure will receive its own secret token. This token should be stored in a secure location and never shared publicly. \n\nIn order to verify webhooks, you will need to check the value of the `X-MBSY-HMAC-SHA256` HTTP header sent with every webhook request. This header is a sha256 base64-encoded hash of the request body and the secret token. \n\nYou can verify the request came from us and that its contents are valid by comparing the value of the `X-MBSY-HMAC-SHA256` header with your own generated hash. See the sidebar for examples of how to do this. If you do not see an example for the language of your choice, let us know, and we'll be happy to help.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"import base64\\nimport hashlib\\nimport hmac\\nimport json\\n\\npayload = json.dumps(WEBHOOK_REQUEST_BODY)\\nsecret = str(WEBHOOK_SECRET_KEY)\\n\\nhm = hmac.new(secret, payload, hashlib.sha256)\\n\\n# compare this to the `X-MBSY-HMAC-SHA256` header value; they should match\\nhm_digest_verify = base64.b64encode(hm.digest())\\n\",\n      \"language\": \"python\",\n      \"name\": null\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","githubsync":"","updates":[],"user":"5634abcb8b86331700b48916","slug":"webhooks-security","sync_unique":"","childrenPages":[]}

Security


Because you receive webhooks via a publicly accessible URL, it is important that you verify your webhooks are genuine. Each webhook you configure will receive its own secret token. This token should be stored in a secure location and never shared publicly. In order to verify webhooks, you will need to check the value of the `X-MBSY-HMAC-SHA256` HTTP header sent with every webhook request. This header is a sha256 base64-encoded hash of the request body and the secret token. You can verify the request came from us and that its contents are valid by comparing the value of the `X-MBSY-HMAC-SHA256` header with your own generated hash. See the sidebar for examples of how to do this. If you do not see an example for the language of your choice, let us know, and we'll be happy to help. [block:code] { "codes": [ { "code": "import base64\nimport hashlib\nimport hmac\nimport json\n\npayload = json.dumps(WEBHOOK_REQUEST_BODY)\nsecret = str(WEBHOOK_SECRET_KEY)\n\nhm = hmac.new(secret, payload, hashlib.sha256)\n\n# compare this to the `X-MBSY-HMAC-SHA256` header value; they should match\nhm_digest_verify = base64.b64encode(hm.digest())\n", "language": "python", "name": null } ], "sidebar": true } [/block]
Because you receive webhooks via a publicly accessible URL, it is important that you verify your webhooks are genuine. Each webhook you configure will receive its own secret token. This token should be stored in a secure location and never shared publicly. In order to verify webhooks, you will need to check the value of the `X-MBSY-HMAC-SHA256` HTTP header sent with every webhook request. This header is a sha256 base64-encoded hash of the request body and the secret token. You can verify the request came from us and that its contents are valid by comparing the value of the `X-MBSY-HMAC-SHA256` header with your own generated hash. See the sidebar for examples of how to do this. If you do not see an example for the language of your choice, let us know, and we'll be happy to help. [block:code] { "codes": [ { "code": "import base64\nimport hashlib\nimport hmac\nimport json\n\npayload = json.dumps(WEBHOOK_REQUEST_BODY)\nsecret = str(WEBHOOK_SECRET_KEY)\n\nhm = hmac.new(secret, payload, hashlib.sha256)\n\n# compare this to the `X-MBSY-HMAC-SHA256` header value; they should match\nhm_digest_verify = base64.b64encode(hm.digest())\n", "language": "python", "name": null } ], "sidebar": true } [/block]
{"_id":"5898f11f372db21b008cb140","isReference":true,"link_external":false,"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"Make sure the url you provide to consume the webhook returns a 200 or 201 response code when requested.  Your url must provide a response within 10 seconds or it will be treated as a failed response.\",\n  \"title\": \"HTTP Response Code\"\n}\n[/block]\nWhen Ambassador receives a non-200 HTTP response code or a response longer than the 10 seconds from your URL, it will retry sending the webhook after 5 minutes and again after 30 minutes. Every event receives an `event_id` in the webhook data. This is useful if you need to ensure you do not process the event more than once.","link_url":"","next":{"pages":[],"description":""},"project":"5634abe66d460f0d0061264f","api":{"results":{"codes":[{"language":"json","code":"{}","name":"","status":200},{"code":"{}","name":"","status":400,"language":"json"}]},"settings":"","auth":"required","params":[],"url":""},"createdAt":"2017-02-06T21:56:47.349Z","slug":"webhook-retries","type":"basic","updates":[],"user":"5634abcb8b86331700b48916","version":"5634abe66d460f0d00612652","sync_unique":"","__v":0,"category":"5898ea852f65061b002c8712","excerpt":"","githubsync":"","hidden":false,"order":2,"parentDoc":null,"title":"Retries","childrenPages":[]}

Retries


[block:callout] { "type": "warning", "body": "Make sure the url you provide to consume the webhook returns a 200 or 201 response code when requested. Your url must provide a response within 10 seconds or it will be treated as a failed response.", "title": "HTTP Response Code" } [/block] When Ambassador receives a non-200 HTTP response code or a response longer than the 10 seconds from your URL, it will retry sending the webhook after 5 minutes and again after 30 minutes. Every event receives an `event_id` in the webhook data. This is useful if you need to ensure you do not process the event more than once.
[block:callout] { "type": "warning", "body": "Make sure the url you provide to consume the webhook returns a 200 or 201 response code when requested. Your url must provide a response within 10 seconds or it will be treated as a failed response.", "title": "HTTP Response Code" } [/block] When Ambassador receives a non-200 HTTP response code or a response longer than the 10 seconds from your URL, it will retry sending the webhook after 5 minutes and again after 30 minutes. Every event receives an `event_id` in the webhook data. This is useful if you need to ensure you do not process the event more than once.
{"_id":"5898f2a4372db21b008cb146","parentDoc":null,"slug":"webhooks-contact-created","createdAt":"2017-02-06T22:03:16.395Z","link_url":"","sync_unique":"","updates":[],"version":"5634abe66d460f0d00612652","category":"5898ea852f65061b002c8712","isReference":true,"body":"__Event Data Objects:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Object\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Description\",\n    \"0-2\": \"The created contact's data\",\n    \"0-0\": \"contact\",\n    \"0-1\": \"The created contact's data\"\n  },\n  \"cols\": 2,\n  \"rows\": 1\n}\n[/block]\n__Contact Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"integer\",\n    \"0-2\": \"unique identifier of the contact within Ambassador\",\n    \"1-0\": \"first_name\",\n    \"1-1\": \"string\",\n    \"1-2\": \"first name\",\n    \"2-0\": \"last_name\",\n    \"2-1\": \"string\",\n    \"2-2\": \"last name\",\n    \"3-0\": \"email\",\n    \"3-1\": \"string\",\n    \"3-2\": \"email address\",\n    \"5-0\": \"test_mode\",\n    \"5-1\": \"boolean\",\n    \"5-2\": \"is this contact in test mode?\",\n    \"6-0\": \"created_at\",\n    \"6-1\": \"date\",\n    \"6-2\": \"date contact was created\",\n    \"7-0\": \"enrolled_at\",\n    \"7-1\": \"date\",\n    \"7-2\": \"date contact was enrolled\",\n    \"8-0\": \"unenrolled_at\",\n    \"8-1\": \"date\",\n    \"8-2\": \"date contact was unenrolled\",\n    \"9-0\": \"status\",\n    \"9-1\": \"string\",\n    \"9-2\": \"enrolled, banned, or unsubscribed\",\n    \"10-0\": \"phone\",\n    \"10-1\": \"string\",\n    \"10-2\": \"phone number\",\n    \"11-0\": \"company\",\n    \"12-0\": \"job_title\",\n    \"13-0\": \"street\",\n    \"14-0\": \"city\",\n    \"15-0\": \"state\",\n    \"16-0\": \"zip\",\n    \"17-0\": \"country\",\n    \"11-1\": \"string\",\n    \"11-2\": \"company name\",\n    \"12-1\": \"string\",\n    \"12-2\": \"job title\",\n    \"13-1\": \"string\",\n    \"13-2\": \"street address\",\n    \"14-1\": \"string\",\n    \"14-2\": \"city\",\n    \"15-1\": \"string\",\n    \"15-2\": \"state\",\n    \"16-1\": \"string\",\n    \"16-2\": \"zip / postal code\",\n    \"17-1\": \"string\",\n    \"17-2\": \"country\",\n    \"4-0\": \"internal_id\",\n    \"4-1\": \"string\",\n    \"4-2\": \"unique identifier of the contact supplied by you\",\n    \"18-0\": \"memorable url\",\n    \"18-1\": \"string\",\n    \"18-2\": \"the contact's memorable url\"\n  },\n  \"cols\": 3,\n  \"rows\": 19\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"Webhook Result Format\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"webhook_version\\\": 0.1,\\n    \\\"created_at\\\": \\\"2012-01-19T18:55:10\\\",\\n    \\\"event_id\\\": 123,\\n    \\\"event_type\\\": \\\"contact-created\\\",\\n    \\\"event_data\\\": {\\n    \\t\\\"contact\\\": {\\n            \\\"id\\\": 100,\\n            \\\"first_name\\\": \\\"First\\\",\\n            \\\"last_name\\\": \\\"Last\\\",\\n            \\\"email\\\": \\\"email@example.com\\\",\\n            \\\"test_mode\\\": false,\\n            \\\"created_at\\\": \\\"2012-01-19T18:55:10\\\",\\n            \\\"enrolled_at\\\": \\\"2015-09-16T21:30:49.710\\\",\\n            \\\"unenrolled_at\\\": \\\"2016-10-12T12:01:22.239\\\",\\n            \\\"status\\\": \\\"enrolled\\\",\\n            \\\"internal_id\\\": \\\"your-company-contact-id\\\",\\n            \\\"phone\\\": \\\"555.555.5555\\\",\\n            \\\"company\\\": \\\"Ambassador\\\",\\n            \\\"job_title\\\": \\\"Developer\\\",\\n            \\\"street\\\": \\\"1 Main Street\\\",\\n            \\\"city\\\": \\\"Springfield\\\",\\n            \\\"state\\\": \\\"Michigan\\\",\\n            \\\"zip\\\": \\\"48000\\\",\\n            \\\"country\\\": \\\"United States\\\",\\n            \\\"memorable_url\\\": \\\"http://mbsy.co/Company/username/\\\"\\n        }\\n    }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","next":{"pages":[],"description":""},"project":"5634abe66d460f0d0061264f","title":"Contact Created","type":"fn","__v":0,"api":{"auth":"required","params":[],"url":"","examples":{"codes":[]},"results":{"codes":[{"language":"json","code":"{}","name":"","status":200},{"status":400,"language":"json","code":"{}","name":""}]},"settings":""},"hidden":false,"link_external":false,"order":3,"user":"5634abcb8b86331700b48916","excerpt":"This event occurs whenever a contact is created.","githubsync":"","childrenPages":[]}

Contact Created

This event occurs whenever a contact is created.

__Event Data Objects:__ [block:parameters] { "data": { "h-0": "Object", "h-1": "Description", "h-2": "Description", "0-2": "The created contact's data", "0-0": "contact", "0-1": "The created contact's data" }, "cols": 2, "rows": 1 } [/block] __Contact Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "unique identifier of the contact within Ambassador", "1-0": "first_name", "1-1": "string", "1-2": "first name", "2-0": "last_name", "2-1": "string", "2-2": "last name", "3-0": "email", "3-1": "string", "3-2": "email address", "5-0": "test_mode", "5-1": "boolean", "5-2": "is this contact in test mode?", "6-0": "created_at", "6-1": "date", "6-2": "date contact was created", "7-0": "enrolled_at", "7-1": "date", "7-2": "date contact was enrolled", "8-0": "unenrolled_at", "8-1": "date", "8-2": "date contact was unenrolled", "9-0": "status", "9-1": "string", "9-2": "enrolled, banned, or unsubscribed", "10-0": "phone", "10-1": "string", "10-2": "phone number", "11-0": "company", "12-0": "job_title", "13-0": "street", "14-0": "city", "15-0": "state", "16-0": "zip", "17-0": "country", "11-1": "string", "11-2": "company name", "12-1": "string", "12-2": "job title", "13-1": "string", "13-2": "street address", "14-1": "string", "14-2": "city", "15-1": "string", "15-2": "state", "16-1": "string", "16-2": "zip / postal code", "17-1": "string", "17-2": "country", "4-0": "internal_id", "4-1": "string", "4-2": "unique identifier of the contact supplied by you", "18-0": "memorable url", "18-1": "string", "18-2": "the contact's memorable url" }, "cols": 3, "rows": 19 } [/block] [block:textarea] { "text": "Webhook Result Format", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"event_id\": 123,\n \"event_type\": \"contact-created\",\n \"event_data\": {\n \t\"contact\": {\n \"id\": 100,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email@example.com\",\n \"test_mode\": false,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"enrolled_at\": \"2015-09-16T21:30:49.710\",\n \"unenrolled_at\": \"2016-10-12T12:01:22.239\",\n \"status\": \"enrolled\",\n \"internal_id\": \"your-company-contact-id\",\n \"phone\": \"555.555.5555\",\n \"company\": \"Ambassador\",\n \"job_title\": \"Developer\",\n \"street\": \"1 Main Street\",\n \"city\": \"Springfield\",\n \"state\": \"Michigan\",\n \"zip\": \"48000\",\n \"country\": \"United States\",\n \"memorable_url\": \"http://mbsy.co/Company/username/\"\n }\n }\n}", "language": "json", "name": "JSON" } ], "sidebar": true } [/block]
__Event Data Objects:__ [block:parameters] { "data": { "h-0": "Object", "h-1": "Description", "h-2": "Description", "0-2": "The created contact's data", "0-0": "contact", "0-1": "The created contact's data" }, "cols": 2, "rows": 1 } [/block] __Contact Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "unique identifier of the contact within Ambassador", "1-0": "first_name", "1-1": "string", "1-2": "first name", "2-0": "last_name", "2-1": "string", "2-2": "last name", "3-0": "email", "3-1": "string", "3-2": "email address", "5-0": "test_mode", "5-1": "boolean", "5-2": "is this contact in test mode?", "6-0": "created_at", "6-1": "date", "6-2": "date contact was created", "7-0": "enrolled_at", "7-1": "date", "7-2": "date contact was enrolled", "8-0": "unenrolled_at", "8-1": "date", "8-2": "date contact was unenrolled", "9-0": "status", "9-1": "string", "9-2": "enrolled, banned, or unsubscribed", "10-0": "phone", "10-1": "string", "10-2": "phone number", "11-0": "company", "12-0": "job_title", "13-0": "street", "14-0": "city", "15-0": "state", "16-0": "zip", "17-0": "country", "11-1": "string", "11-2": "company name", "12-1": "string", "12-2": "job title", "13-1": "string", "13-2": "street address", "14-1": "string", "14-2": "city", "15-1": "string", "15-2": "state", "16-1": "string", "16-2": "zip / postal code", "17-1": "string", "17-2": "country", "4-0": "internal_id", "4-1": "string", "4-2": "unique identifier of the contact supplied by you", "18-0": "memorable url", "18-1": "string", "18-2": "the contact's memorable url" }, "cols": 3, "rows": 19 } [/block] [block:textarea] { "text": "Webhook Result Format", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"event_id\": 123,\n \"event_type\": \"contact-created\",\n \"event_data\": {\n \t\"contact\": {\n \"id\": 100,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email@example.com\",\n \"test_mode\": false,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"enrolled_at\": \"2015-09-16T21:30:49.710\",\n \"unenrolled_at\": \"2016-10-12T12:01:22.239\",\n \"status\": \"enrolled\",\n \"internal_id\": \"your-company-contact-id\",\n \"phone\": \"555.555.5555\",\n \"company\": \"Ambassador\",\n \"job_title\": \"Developer\",\n \"street\": \"1 Main Street\",\n \"city\": \"Springfield\",\n \"state\": \"Michigan\",\n \"zip\": \"48000\",\n \"country\": \"United States\",\n \"memorable_url\": \"http://mbsy.co/Company/username/\"\n }\n }\n}", "language": "json", "name": "JSON" } ], "sidebar": true } [/block]
{"_id":"589b9163dbb7cd1900267337","isReference":true,"updates":[],"user":"5634abcb8b86331700b48916","createdAt":"2017-02-08T21:45:07.845Z","excerpt":"This event occurs whenever a contact's status is changed e.g. contact is enrolled","order":4,"slug":"webhooks-contact-status-updated","sync_unique":"","api":{"results":{"codes":[{"code":"{}","name":"","status":200,"language":"json"},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"body":"__Event Data Objects:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Description\",\n    \"0-2\": \"The referring contact's data\",\n    \"0-0\": \"contact\",\n    \"0-1\": \"The referring contact's data\"\n  },\n  \"cols\": 2,\n  \"rows\": 1\n}\n[/block]\n__Contact Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"integer\",\n    \"0-2\": \"unique identifier of the contact within Ambassador\",\n    \"1-0\": \"first_name\",\n    \"1-1\": \"string\",\n    \"1-2\": \"first name of the contact\",\n    \"2-0\": \"last_name\",\n    \"2-1\": \"string\",\n    \"2-2\": \"last name of the contact\",\n    \"3-0\": \"email\",\n    \"3-1\": \"string\",\n    \"3-2\": \"email of the contact\",\n    \"5-0\": \"test_mode\",\n    \"5-1\": \"boolean\",\n    \"5-2\": \"is the contact in test mode?\",\n    \"6-0\": \"created_at\",\n    \"6-1\": \"date\",\n    \"6-2\": \"date contact was created\",\n    \"7-0\": \"enrolled_at\",\n    \"7-1\": \"date\",\n    \"7-2\": \"date contact was enrolled\",\n    \"8-0\": \"unenrolled_at\",\n    \"8-1\": \"date\",\n    \"8-2\": \"date contact was unenrolled\",\n    \"9-0\": \"status\",\n    \"9-1\": \"string\",\n    \"9-2\": \"status of contact\",\n    \"10-0\": \"phone\",\n    \"10-1\": \"string\",\n    \"10-2\": \"phone number\",\n    \"11-0\": \"company\",\n    \"12-0\": \"job_title\",\n    \"13-0\": \"street\",\n    \"14-0\": \"city\",\n    \"15-0\": \"state\",\n    \"16-0\": \"zip\",\n    \"17-0\": \"country\",\n    \"11-1\": \"string\",\n    \"11-2\": \"company name of the contact\",\n    \"12-1\": \"string\",\n    \"12-2\": \"contact's job title\",\n    \"13-1\": \"string\",\n    \"13-2\": \"contact's street address\",\n    \"14-1\": \"string\",\n    \"14-2\": \"contact's city\",\n    \"15-1\": \"string\",\n    \"15-2\": \"contact's state\",\n    \"16-1\": \"string\",\n    \"16-2\": \"contact's zip / postal code\",\n    \"17-1\": \"string\",\n    \"17-2\": \"contact's country\",\n    \"4-0\": \"internal_id\",\n    \"4-1\": \"string\",\n    \"4-2\": \"unique identifier of the contact within your system\",\n    \"18-0\": \"memorable_url\",\n    \"18-1\": \"string\",\n    \"18-2\": \"contact's memorable url\"\n  },\n  \"cols\": 3,\n  \"rows\": 19\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"Webhook Result Format\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"webhook_version\\\": 0.1,\\n    \\\"created_at\\\": \\\"2012-01-19T18:55:10\\\",\\n    \\\"event_id\\\": 123,\\n    \\\"event_type\\\": \\\"contact-status-updated\\\",\\n    \\\"event_data\\\": {\\n    \\t\\\"contact\\\": {\\n            \\\"id\\\": 100,\\n            \\\"first_name\\\": \\\"First\\\",\\n            \\\"last_name\\\": \\\"Last\\\",\\n            \\\"email\\\": \\\"email@example.com\\\",\\n            \\\"test_mode\\\": false,\\n            \\\"created_at\\\": \\\"2012-01-19T18:55:10\\\",\\n            \\\"enrolled_at\\\": \\\"2015-09-16T21:30:49.710\\\",\\n            \\\"unenrolled_at\\\": \\\"2016-10-12T12:01:22.239\\\",\\n            \\\"status\\\": \\\"enrolled\\\",\\n            \\\"internal_id\\\": \\\"your-company-contact-id\\\",\\n            \\\"phone\\\": \\\"555.555.5555\\\",\\n            \\\"company\\\": \\\"Ambassador\\\",\\n            \\\"job_title\\\": \\\"Developer\\\",\\n            \\\"street\\\": \\\"775 Bennaville Ave\\\",\\n            \\\"city\\\": \\\"Birmingham\\\",\\n            \\\"state\\\": \\\"Michigan\\\",\\n            \\\"zip\\\": \\\"48098\\\",\\n            \\\"country\\\": \\\"United States\\\",\\n            \\\"memorable_url\\\": \\\"http://mbsy.co/Company/username/\\\"\\n        }\\n    }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","githubsync":"","link_url":"","parentDoc":null,"title":"Contact Status Updated","type":"fn","version":"5634abe66d460f0d00612652","__v":0,"category":"5898ea852f65061b002c8712","link_external":false,"hidden":false,"next":{"pages":[],"description":""},"project":"5634abe66d460f0d0061264f","childrenPages":[]}

Contact Status Updated

This event occurs whenever a contact's status is changed e.g. contact is enrolled

__Event Data Objects:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "h-2": "Description", "0-2": "The referring contact's data", "0-0": "contact", "0-1": "The referring contact's data" }, "cols": 2, "rows": 1 } [/block] __Contact Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "unique identifier of the contact within Ambassador", "1-0": "first_name", "1-1": "string", "1-2": "first name of the contact", "2-0": "last_name", "2-1": "string", "2-2": "last name of the contact", "3-0": "email", "3-1": "string", "3-2": "email of the contact", "5-0": "test_mode", "5-1": "boolean", "5-2": "is the contact in test mode?", "6-0": "created_at", "6-1": "date", "6-2": "date contact was created", "7-0": "enrolled_at", "7-1": "date", "7-2": "date contact was enrolled", "8-0": "unenrolled_at", "8-1": "date", "8-2": "date contact was unenrolled", "9-0": "status", "9-1": "string", "9-2": "status of contact", "10-0": "phone", "10-1": "string", "10-2": "phone number", "11-0": "company", "12-0": "job_title", "13-0": "street", "14-0": "city", "15-0": "state", "16-0": "zip", "17-0": "country", "11-1": "string", "11-2": "company name of the contact", "12-1": "string", "12-2": "contact's job title", "13-1": "string", "13-2": "contact's street address", "14-1": "string", "14-2": "contact's city", "15-1": "string", "15-2": "contact's state", "16-1": "string", "16-2": "contact's zip / postal code", "17-1": "string", "17-2": "contact's country", "4-0": "internal_id", "4-1": "string", "4-2": "unique identifier of the contact within your system", "18-0": "memorable_url", "18-1": "string", "18-2": "contact's memorable url" }, "cols": 3, "rows": 19 } [/block] [block:textarea] { "text": "Webhook Result Format", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"event_id\": 123,\n \"event_type\": \"contact-status-updated\",\n \"event_data\": {\n \t\"contact\": {\n \"id\": 100,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email@example.com\",\n \"test_mode\": false,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"enrolled_at\": \"2015-09-16T21:30:49.710\",\n \"unenrolled_at\": \"2016-10-12T12:01:22.239\",\n \"status\": \"enrolled\",\n \"internal_id\": \"your-company-contact-id\",\n \"phone\": \"555.555.5555\",\n \"company\": \"Ambassador\",\n \"job_title\": \"Developer\",\n \"street\": \"775 Bennaville Ave\",\n \"city\": \"Birmingham\",\n \"state\": \"Michigan\",\n \"zip\": \"48098\",\n \"country\": \"United States\",\n \"memorable_url\": \"http://mbsy.co/Company/username/\"\n }\n }\n}", "language": "json", "name": "JSON" } ], "sidebar": true } [/block]
__Event Data Objects:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "h-2": "Description", "0-2": "The referring contact's data", "0-0": "contact", "0-1": "The referring contact's data" }, "cols": 2, "rows": 1 } [/block] __Contact Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "unique identifier of the contact within Ambassador", "1-0": "first_name", "1-1": "string", "1-2": "first name of the contact", "2-0": "last_name", "2-1": "string", "2-2": "last name of the contact", "3-0": "email", "3-1": "string", "3-2": "email of the contact", "5-0": "test_mode", "5-1": "boolean", "5-2": "is the contact in test mode?", "6-0": "created_at", "6-1": "date", "6-2": "date contact was created", "7-0": "enrolled_at", "7-1": "date", "7-2": "date contact was enrolled", "8-0": "unenrolled_at", "8-1": "date", "8-2": "date contact was unenrolled", "9-0": "status", "9-1": "string", "9-2": "status of contact", "10-0": "phone", "10-1": "string", "10-2": "phone number", "11-0": "company", "12-0": "job_title", "13-0": "street", "14-0": "city", "15-0": "state", "16-0": "zip", "17-0": "country", "11-1": "string", "11-2": "company name of the contact", "12-1": "string", "12-2": "contact's job title", "13-1": "string", "13-2": "contact's street address", "14-1": "string", "14-2": "contact's city", "15-1": "string", "15-2": "contact's state", "16-1": "string", "16-2": "contact's zip / postal code", "17-1": "string", "17-2": "contact's country", "4-0": "internal_id", "4-1": "string", "4-2": "unique identifier of the contact within your system", "18-0": "memorable_url", "18-1": "string", "18-2": "contact's memorable url" }, "cols": 3, "rows": 19 } [/block] [block:textarea] { "text": "Webhook Result Format", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"event_id\": 123,\n \"event_type\": \"contact-status-updated\",\n \"event_data\": {\n \t\"contact\": {\n \"id\": 100,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email@example.com\",\n \"test_mode\": false,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"enrolled_at\": \"2015-09-16T21:30:49.710\",\n \"unenrolled_at\": \"2016-10-12T12:01:22.239\",\n \"status\": \"enrolled\",\n \"internal_id\": \"your-company-contact-id\",\n \"phone\": \"555.555.5555\",\n \"company\": \"Ambassador\",\n \"job_title\": \"Developer\",\n \"street\": \"775 Bennaville Ave\",\n \"city\": \"Birmingham\",\n \"state\": \"Michigan\",\n \"zip\": \"48098\",\n \"country\": \"United States\",\n \"memorable_url\": \"http://mbsy.co/Company/username/\"\n }\n }\n}", "language": "json", "name": "JSON" } ], "sidebar": true } [/block]
{"_id":"589b8b39d7cfb619008ebb4d","createdAt":"2017-02-08T21:18:49.547Z","link_external":false,"link_url":"","next":{"pages":[],"description":""},"githubsync":"","isReference":true,"parentDoc":null,"slug":"webhooks-share-tracked","sync_unique":"","user":"5634abcb8b86331700b48916","type":"fn","updates":[],"__v":0,"category":"5898ea852f65061b002c8712","hidden":false,"order":5,"project":"5634abe66d460f0d0061264f","title":"Share Tracked","version":"5634abe66d460f0d00612652","api":{"results":{"codes":[{"language":"json","code":"{}","name":"","status":200},{"code":"{}","name":"","status":400,"language":"json"}]},"settings":"","auth":"required","params":[],"url":""},"body":"__Event Data Objects:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Description\",\n    \"0-2\": \"The referring contact's data\",\n    \"0-0\": \"contact\",\n    \"0-1\": \"The referring contact's data\",\n    \"1-0\": \"share\",\n    \"1-1\": \"The share event's data\",\n    \"1-2\": \"The share event's data\",\n    \"2-0\": \"url\",\n    \"2-1\": \"The referring contact's url data\",\n    \"2-2\": \"The referring contact's url data\",\n    \"3-0\": \"campaign\",\n    \"3-1\": \"The campaign the share was tracked for\",\n    \"3-2\": \"The campaign the share was tracked for\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]\n__Contact Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"integer\",\n    \"0-2\": \"id of the contact\",\n    \"1-0\": \"first_name\",\n    \"1-1\": \"string\",\n    \"1-2\": \"first name of the contact\",\n    \"2-0\": \"last_name\",\n    \"2-1\": \"string\",\n    \"2-2\": \"last name of the contact\",\n    \"3-0\": \"email\",\n    \"3-1\": \"string\",\n    \"3-2\": \"email of the contact\",\n    \"4-0\": \"internal_id\",\n    \"4-1\": \"string\",\n    \"4-2\": \"unique identifier of the contact supplied by you\"\n  },\n  \"cols\": 3,\n  \"rows\": 5\n}\n[/block]\n__Share Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"created_at\",\n    \"0-1\": \"date\",\n    \"0-2\": \"date shared\",\n    \"1-0\": \"social_name\",\n    \"1-1\": \"string\",\n    \"1-2\": \"social name of share\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]\n__URL Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"short_code\",\n    \"0-1\": \"string\",\n    \"0-2\": \"short code of url\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\n__Campaign Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"integer\",\n    \"0-2\": \"campaign's ID\",\n    \"1-0\": \"name\",\n    \"1-1\": \"string\",\n    \"1-2\": \"campaign's name\",\n    \"2-0\": \"description\",\n    \"2-1\": \"string\",\n    \"2-2\": \"campaign's description\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"Webhook Result Format\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"webhook_version\\\": 0.1,\\n    \\\"created_at\\\": \\\"2012-01-19T18:55:10\\\",\\n    \\\"event_id\\\": 123,\\n    \\\"event_type\\\": \\\"share-tracked\\\",\\n    \\\"event_data\\\": {\\n    \\t\\\"contact\\\": {\\n        \\\"id\\\": 100,\\n        \\\"first_name\\\": \\\"First\\\",\\n        \\\"last_name\\\": \\\"Last\\\",\\n        \\\"email\\\": \\\"email@example.com\\\"\\n      },\\n      \\\"share\\\": {\\n        \\\"created_at\\\": \\\"2012-01-19T18:55:10\\\",\\n        \\\"social_name\\\": \\\"email\\\"\\n      },\\n      \\\"url\\\": {\\n        \\\"short_code\\\": \\\"dq\\\",\\n      },\\n  \\t\\t\\\"campaign\\\": {\\n        \\\"id\\\": 123,\\n        \\\"name\\\": \\\"Sample Campaign\\\",\\n        \\\"description\\\": \\\"This is a sample description.\\\"\\n      }\\n    }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","excerpt":"This event occurs whenever a share is tracked.","childrenPages":[]}

Share Tracked

This event occurs whenever a share is tracked.

__Event Data Objects:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "h-2": "Description", "0-2": "The referring contact's data", "0-0": "contact", "0-1": "The referring contact's data", "1-0": "share", "1-1": "The share event's data", "1-2": "The share event's data", "2-0": "url", "2-1": "The referring contact's url data", "2-2": "The referring contact's url data", "3-0": "campaign", "3-1": "The campaign the share was tracked for", "3-2": "The campaign the share was tracked for" }, "cols": 2, "rows": 4 } [/block] __Contact Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "id of the contact", "1-0": "first_name", "1-1": "string", "1-2": "first name of the contact", "2-0": "last_name", "2-1": "string", "2-2": "last name of the contact", "3-0": "email", "3-1": "string", "3-2": "email of the contact", "4-0": "internal_id", "4-1": "string", "4-2": "unique identifier of the contact supplied by you" }, "cols": 3, "rows": 5 } [/block] __Share Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "created_at", "0-1": "date", "0-2": "date shared", "1-0": "social_name", "1-1": "string", "1-2": "social name of share" }, "cols": 3, "rows": 2 } [/block] __URL Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "short_code", "0-1": "string", "0-2": "short code of url" }, "cols": 3, "rows": 1 } [/block] __Campaign Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "campaign's ID", "1-0": "name", "1-1": "string", "1-2": "campaign's name", "2-0": "description", "2-1": "string", "2-2": "campaign's description" }, "cols": 3, "rows": 3 } [/block] [block:textarea] { "text": "Webhook Result Format", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"event_id\": 123,\n \"event_type\": \"share-tracked\",\n \"event_data\": {\n \t\"contact\": {\n \"id\": 100,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email@example.com\"\n },\n \"share\": {\n \"created_at\": \"2012-01-19T18:55:10\",\n \"social_name\": \"email\"\n },\n \"url\": {\n \"short_code\": \"dq\",\n },\n \t\t\"campaign\": {\n \"id\": 123,\n \"name\": \"Sample Campaign\",\n \"description\": \"This is a sample description.\"\n }\n }\n}", "language": "json", "name": "JSON" } ], "sidebar": true } [/block]
__Event Data Objects:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "h-2": "Description", "0-2": "The referring contact's data", "0-0": "contact", "0-1": "The referring contact's data", "1-0": "share", "1-1": "The share event's data", "1-2": "The share event's data", "2-0": "url", "2-1": "The referring contact's url data", "2-2": "The referring contact's url data", "3-0": "campaign", "3-1": "The campaign the share was tracked for", "3-2": "The campaign the share was tracked for" }, "cols": 2, "rows": 4 } [/block] __Contact Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "id of the contact", "1-0": "first_name", "1-1": "string", "1-2": "first name of the contact", "2-0": "last_name", "2-1": "string", "2-2": "last name of the contact", "3-0": "email", "3-1": "string", "3-2": "email of the contact", "4-0": "internal_id", "4-1": "string", "4-2": "unique identifier of the contact supplied by you" }, "cols": 3, "rows": 5 } [/block] __Share Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "created_at", "0-1": "date", "0-2": "date shared", "1-0": "social_name", "1-1": "string", "1-2": "social name of share" }, "cols": 3, "rows": 2 } [/block] __URL Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "short_code", "0-1": "string", "0-2": "short code of url" }, "cols": 3, "rows": 1 } [/block] __Campaign Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "campaign's ID", "1-0": "name", "1-1": "string", "1-2": "campaign's name", "2-0": "description", "2-1": "string", "2-2": "campaign's description" }, "cols": 3, "rows": 3 } [/block] [block:textarea] { "text": "Webhook Result Format", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"event_id\": 123,\n \"event_type\": \"share-tracked\",\n \"event_data\": {\n \t\"contact\": {\n \"id\": 100,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email@example.com\"\n },\n \"share\": {\n \"created_at\": \"2012-01-19T18:55:10\",\n \"social_name\": \"email\"\n },\n \"url\": {\n \"short_code\": \"dq\",\n },\n \t\t\"campaign\": {\n \"id\": 123,\n \"name\": \"Sample Campaign\",\n \"description\": \"This is a sample description.\"\n }\n }\n}", "language": "json", "name": "JSON" } ], "sidebar": true } [/block]
{"_id":"589b8c03d7cfb619008ebb51","title":"Click Tracked","updates":[],"link_url":"","next":{"pages":[],"description":""},"order":6,"parentDoc":null,"project":"5634abe66d460f0d0061264f","slug":"webhooks-click-tracked","user":"5634abcb8b86331700b48916","api":{"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"language":"json","code":"{}","name":"","status":400}]},"settings":"","auth":"required","params":[]},"category":"5898ea852f65061b002c8712","createdAt":"2017-02-08T21:22:11.434Z","link_external":false,"sync_unique":"","githubsync":"","hidden":false,"isReference":true,"__v":0,"body":"__Event Data Objects:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Description\",\n    \"0-2\": \"The referring contact's data\",\n    \"0-0\": \"contact\",\n    \"0-1\": \"the referring contact's data\",\n    \"1-0\": \"click\",\n    \"1-1\": \"the click event's data\",\n    \"1-2\": \"The click event's data\",\n    \"2-0\": \"url\",\n    \"2-1\": \"the url's data\",\n    \"2-2\": \"The url's data\",\n    \"3-0\": \"campaign\",\n    \"3-1\": \"the campaign's data\",\n    \"3-2\": \"the campaign's data\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]\n__Contact Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"integer\",\n    \"0-2\": \"unique identifier of the contact within Ambassador\",\n    \"1-0\": \"first_name\",\n    \"1-1\": \"string\",\n    \"1-2\": \"first name of the contact\",\n    \"2-0\": \"last_name\",\n    \"2-1\": \"string\",\n    \"2-2\": \"last name of the contact\",\n    \"3-0\": \"email\",\n    \"3-1\": \"string\",\n    \"3-2\": \"email of the contact\",\n    \"4-0\": \"internal_id\",\n    \"4-1\": \"string\",\n    \"4-2\": \"unique identifier of the contact supplied by you\"\n  },\n  \"cols\": 3,\n  \"rows\": 5\n}\n[/block]\n__Click Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"created_at\",\n    \"0-1\": \"date\",\n    \"0-2\": \"date clicked\",\n    \"1-0\": \"social_name\",\n    \"1-1\": \"string\",\n    \"1-2\": \"social name of click\",\n    \"2-0\": \"ip\",\n    \"2-1\": \"string\",\n    \"2-2\": \"ip address of click\",\n    \"3-0\": \"referring_url\",\n    \"3-1\": \"string\",\n    \"3-2\": \"referring url of click (if exists)\"\n  },\n  \"cols\": 3,\n  \"rows\": 4\n}\n[/block]\n__URL Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"short_code\",\n    \"0-1\": \"string\",\n    \"0-2\": \"short code of url\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\n__Campaign Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"integer\",\n    \"0-2\": \"campaign's ID\",\n    \"1-0\": \"name\",\n    \"1-1\": \"string\",\n    \"1-2\": \"campaign's name\",\n    \"2-0\": \"description\",\n    \"2-1\": \"string\",\n    \"2-2\": \"campaign's description\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"Webhook Result Format\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"webhook_version\\\": 0.1,\\n    \\\"created_at\\\": \\\"2012-01-19T18:55:10\\\",\\n    \\\"event_id\\\": 123,\\n    \\\"event_type\\\": \\\"click-tracked\\\",\\n    \\\"event_data\\\": {\\n    \\t\\\"contact\\\": {\\n        \\\"id\\\": 100,\\n        \\\"first_name\\\": \\\"First\\\",\\n        \\\"last_name\\\": \\\"Last\\\",\\n        \\\"email\\\": \\\"email@example.com\\\"\\n      },\\n      \\\"click\\\": {\\n        \\\"created_at\\\": \\\"2012-01-19T18:55:10\\\",\\n        \\\"social_name\\\": \\\"email\\\",\\n        \\\"ip\\\": \\\"102.2.4.11\\\",\\n        \\\"referring_url\\\": \\\"m.facebook.com\\\"\\n      },\\n      \\\"url\\\": {\\n        \\\"short_code\\\": \\\"dq\\\",\\n      },\\n  \\t\\t\\\"campaign\\\": {\\n        \\\"id\\\": 123,\\n        \\\"name\\\": \\\"Sample Campaign\\\",\\n        \\\"description\\\": \\\"This is a sample description.\\\"\\n      }\\n    }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","excerpt":"This event occurs whenever a click is tracked.","type":"fn","version":"5634abe66d460f0d00612652","childrenPages":[]}

Click Tracked

This event occurs whenever a click is tracked.

__Event Data Objects:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "h-2": "Description", "0-2": "The referring contact's data", "0-0": "contact", "0-1": "the referring contact's data", "1-0": "click", "1-1": "the click event's data", "1-2": "The click event's data", "2-0": "url", "2-1": "the url's data", "2-2": "The url's data", "3-0": "campaign", "3-1": "the campaign's data", "3-2": "the campaign's data" }, "cols": 2, "rows": 4 } [/block] __Contact Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "unique identifier of the contact within Ambassador", "1-0": "first_name", "1-1": "string", "1-2": "first name of the contact", "2-0": "last_name", "2-1": "string", "2-2": "last name of the contact", "3-0": "email", "3-1": "string", "3-2": "email of the contact", "4-0": "internal_id", "4-1": "string", "4-2": "unique identifier of the contact supplied by you" }, "cols": 3, "rows": 5 } [/block] __Click Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "created_at", "0-1": "date", "0-2": "date clicked", "1-0": "social_name", "1-1": "string", "1-2": "social name of click", "2-0": "ip", "2-1": "string", "2-2": "ip address of click", "3-0": "referring_url", "3-1": "string", "3-2": "referring url of click (if exists)" }, "cols": 3, "rows": 4 } [/block] __URL Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "short_code", "0-1": "string", "0-2": "short code of url" }, "cols": 3, "rows": 1 } [/block] __Campaign Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "campaign's ID", "1-0": "name", "1-1": "string", "1-2": "campaign's name", "2-0": "description", "2-1": "string", "2-2": "campaign's description" }, "cols": 3, "rows": 3 } [/block] [block:textarea] { "text": "Webhook Result Format", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"event_id\": 123,\n \"event_type\": \"click-tracked\",\n \"event_data\": {\n \t\"contact\": {\n \"id\": 100,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email@example.com\"\n },\n \"click\": {\n \"created_at\": \"2012-01-19T18:55:10\",\n \"social_name\": \"email\",\n \"ip\": \"102.2.4.11\",\n \"referring_url\": \"m.facebook.com\"\n },\n \"url\": {\n \"short_code\": \"dq\",\n },\n \t\t\"campaign\": {\n \"id\": 123,\n \"name\": \"Sample Campaign\",\n \"description\": \"This is a sample description.\"\n }\n }\n}", "language": "json", "name": "JSON" } ], "sidebar": true } [/block]
__Event Data Objects:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "h-2": "Description", "0-2": "The referring contact's data", "0-0": "contact", "0-1": "the referring contact's data", "1-0": "click", "1-1": "the click event's data", "1-2": "The click event's data", "2-0": "url", "2-1": "the url's data", "2-2": "The url's data", "3-0": "campaign", "3-1": "the campaign's data", "3-2": "the campaign's data" }, "cols": 2, "rows": 4 } [/block] __Contact Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "unique identifier of the contact within Ambassador", "1-0": "first_name", "1-1": "string", "1-2": "first name of the contact", "2-0": "last_name", "2-1": "string", "2-2": "last name of the contact", "3-0": "email", "3-1": "string", "3-2": "email of the contact", "4-0": "internal_id", "4-1": "string", "4-2": "unique identifier of the contact supplied by you" }, "cols": 3, "rows": 5 } [/block] __Click Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "created_at", "0-1": "date", "0-2": "date clicked", "1-0": "social_name", "1-1": "string", "1-2": "social name of click", "2-0": "ip", "2-1": "string", "2-2": "ip address of click", "3-0": "referring_url", "3-1": "string", "3-2": "referring url of click (if exists)" }, "cols": 3, "rows": 4 } [/block] __URL Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "short_code", "0-1": "string", "0-2": "short code of url" }, "cols": 3, "rows": 1 } [/block] __Campaign Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "campaign's ID", "1-0": "name", "1-1": "string", "1-2": "campaign's name", "2-0": "description", "2-1": "string", "2-2": "campaign's description" }, "cols": 3, "rows": 3 } [/block] [block:textarea] { "text": "Webhook Result Format", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"event_id\": 123,\n \"event_type\": \"click-tracked\",\n \"event_data\": {\n \t\"contact\": {\n \"id\": 100,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email@example.com\"\n },\n \"click\": {\n \"created_at\": \"2012-01-19T18:55:10\",\n \"social_name\": \"email\",\n \"ip\": \"102.2.4.11\",\n \"referring_url\": \"m.facebook.com\"\n },\n \"url\": {\n \"short_code\": \"dq\",\n },\n \t\t\"campaign\": {\n \"id\": 123,\n \"name\": \"Sample Campaign\",\n \"description\": \"This is a sample description.\"\n }\n }\n}", "language": "json", "name": "JSON" } ], "sidebar": true } [/block]
{"_id":"589b8994dbb7cd190026730e","slug":"webhooks-referral-created","sync_unique":"","__v":0,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"body":"__Event Data Objects:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"contact\",\n    \"0-1\": \"The referring contact's data\",\n    \"0-2\": \"The referring contact's data\",\n    \"1-0\": \"referred_contact\",\n    \"1-1\": \"The referred contact's data\",\n    \"1-2\": \"The customer contact's data\"\n  },\n  \"cols\": 2,\n  \"rows\": 2\n}\n[/block]\n__Contact Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"integer\",\n    \"0-2\": \"unique identifier of the contact within Ambassador\",\n    \"1-0\": \"first_name\",\n    \"1-1\": \"string\",\n    \"1-2\": \"first name\",\n    \"2-0\": \"last_name\",\n    \"2-1\": \"string\",\n    \"2-2\": \"last name\",\n    \"3-0\": \"email\",\n    \"3-1\": \"string\",\n    \"3-2\": \"email address\",\n    \"4-0\": \"internal_id\",\n    \"4-1\": \"string\",\n    \"4-2\": \"unique identifier of the contact supplied by you\"\n  },\n  \"cols\": 3,\n  \"rows\": 5\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"Webhook Result Format\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"webhook_version\\\": 0.1,\\n    \\\"created_at\\\": \\\"2012-01-19T18:55:10\\\",\\n    \\\"event_id\\\": 123,\\n    \\\"event_type\\\": \\\"referral-created\\\",\\n    \\\"event_data\\\": {\\n    \\t\\\"contact\\\": {\\n        \\\"id\\\": 100,\\n        \\\"first_name\\\": \\\"First\\\",\\n        \\\"last_name\\\": \\\"Last\\\",\\n        \\\"email\\\": \\\"email@example.com\\\"\\n      },\\n      \\\"referred_contact\\\": {\\n        \\\"id\\\": 101,\\n        \\\"first_name\\\": \\\"First\\\",\\n        \\\"last_name\\\": \\\"Last\\\",\\n        \\\"email\\\": \\\"email2@example.com\\\"\\n      }\\n    }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","createdAt":"2017-02-08T21:11:48.004Z","isReference":true,"project":"5634abe66d460f0d0061264f","title":"Referral Created","version":"5634abe66d460f0d00612652","category":"5898ea852f65061b002c8712","excerpt":"This event occurs whenever a contact refers another contact.","link_external":false,"order":7,"type":"fn","githubsync":"","updates":[],"hidden":false,"link_url":"","next":{"pages":[],"description":""},"parentDoc":null,"user":"5634abcb8b86331700b48916","childrenPages":[]}

Referral Created

This event occurs whenever a contact refers another contact.

__Event Data Objects:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "h-2": "Description", "0-0": "contact", "0-1": "The referring contact's data", "0-2": "The referring contact's data", "1-0": "referred_contact", "1-1": "The referred contact's data", "1-2": "The customer contact's data" }, "cols": 2, "rows": 2 } [/block] __Contact Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "unique identifier of the contact within Ambassador", "1-0": "first_name", "1-1": "string", "1-2": "first name", "2-0": "last_name", "2-1": "string", "2-2": "last name", "3-0": "email", "3-1": "string", "3-2": "email address", "4-0": "internal_id", "4-1": "string", "4-2": "unique identifier of the contact supplied by you" }, "cols": 3, "rows": 5 } [/block] [block:textarea] { "text": "Webhook Result Format", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"event_id\": 123,\n \"event_type\": \"referral-created\",\n \"event_data\": {\n \t\"contact\": {\n \"id\": 100,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email@example.com\"\n },\n \"referred_contact\": {\n \"id\": 101,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email2@example.com\"\n }\n }\n}", "language": "json", "name": "JSON" } ], "sidebar": true } [/block]
__Event Data Objects:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "h-2": "Description", "0-0": "contact", "0-1": "The referring contact's data", "0-2": "The referring contact's data", "1-0": "referred_contact", "1-1": "The referred contact's data", "1-2": "The customer contact's data" }, "cols": 2, "rows": 2 } [/block] __Contact Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "unique identifier of the contact within Ambassador", "1-0": "first_name", "1-1": "string", "1-2": "first name", "2-0": "last_name", "2-1": "string", "2-2": "last name", "3-0": "email", "3-1": "string", "3-2": "email address", "4-0": "internal_id", "4-1": "string", "4-2": "unique identifier of the contact supplied by you" }, "cols": 3, "rows": 5 } [/block] [block:textarea] { "text": "Webhook Result Format", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"event_id\": 123,\n \"event_type\": \"referral-created\",\n \"event_data\": {\n \t\"contact\": {\n \"id\": 100,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email@example.com\"\n },\n \"referred_contact\": {\n \"id\": 101,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email2@example.com\"\n }\n }\n}", "language": "json", "name": "JSON" } ], "sidebar": true } [/block]
{"_id":"5898f4322f65061b002c87f0","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"githubsync":"","isReference":true,"version":"5634abe66d460f0d00612652","__v":0,"category":"5898ea852f65061b002c8712","link_external":false,"title":"Commission Created","updates":[],"user":"5634abcb8b86331700b48916","body":"__Event Data Objects:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Object\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"contact\",\n    \"0-1\": \"The referring contact's data\",\n    \"0-2\": \"The referring contact's data\",\n    \"1-0\": \"referred_contact\",\n    \"1-1\": \"The referred contact's data\",\n    \"1-2\": \"The customer contact's data\",\n    \"2-0\": \"commission\",\n    \"2-1\": \"The commission data\",\n    \"3-0\": \"campaign\",\n    \"3-1\": \"The campaign's data\",\n    \"3-2\": \"The campaign's data\",\n    \"2-2\": \"The commission data\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]\n__Contact Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"integer\",\n    \"0-2\": \"unique identifier of the contact within Ambassador\",\n    \"1-0\": \"first_name\",\n    \"1-1\": \"string\",\n    \"1-2\": \"first name\",\n    \"2-0\": \"last_name\",\n    \"2-1\": \"string\",\n    \"2-2\": \"last name\",\n    \"3-0\": \"email\",\n    \"3-1\": \"string\",\n    \"3-2\": \"email address\",\n    \"4-0\": \"internal_id\",\n    \"4-1\": \"string\",\n    \"4-2\": \"unique identifier of the contact supplied by you\"\n  },\n  \"cols\": 3,\n  \"rows\": 5\n}\n[/block]\n__Campaign Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"integer\",\n    \"0-2\": \"campaign's ID\",\n    \"1-0\": \"name\",\n    \"1-1\": \"string\",\n    \"1-2\": \"campaign's name\",\n    \"2-0\": \"description\",\n    \"2-1\": \"string\",\n    \"2-2\": \"campaign's description\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\n__Commission Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"integer\",\n    \"0-2\": \"commission's ID\",\n    \"1-0\": \"revenue\",\n    \"1-1\": \"number\",\n    \"1-2\": \"revenue amount of commission (ex. customer bought an item worth 20.00)\",\n    \"2-0\": \"amount\",\n    \"2-1\": \"number\",\n    \"2-2\": \"amount earned by commission\\n(ex. contact earns 5.00 commission for referring)\",\n    \"3-0\": \"created_at\",\n    \"3-1\": \"date\",\n    \"4-0\": \"approved_at\",\n    \"4-1\": \"date\",\n    \"5-0\": \"status\",\n    \"5-1\": \"boolean\",\n    \"5-2\": \"commission's status\\n0 = pending\\n1 = approved\\n2 = denied\",\n    \"3-2\": \"date commission was created\",\n    \"4-2\": \"date commission was approved\",\n    \"6-0\": \"transaction_id\",\n    \"6-1\": \"string\",\n    \"6-2\": \"commission's transaction id\"\n  },\n  \"cols\": 3,\n  \"rows\": 7\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"Webhook Result Format\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"webhook_version\\\": 0.1,\\n    \\\"created_at\\\": \\\"2012-01-19T18:55:10\\\",\\n    \\\"event_id\\\": 123,\\n    \\\"event_type\\\": \\\"commission-created\\\",\\n    \\\"event_data\\\": {\\n    \\t\\\"contact\\\": {\\n        \\\"id\\\": 100,\\n        \\\"first_name\\\": \\\"First\\\",\\n        \\\"last_name\\\": \\\"Last\\\",\\n        \\\"email\\\": \\\"email@example.com\\\"\\n      },\\n      \\\"referred_contact\\\": {\\n        \\\"id\\\": 101,\\n        \\\"first_name\\\": \\\"First\\\",\\n        \\\"last_name\\\": \\\"Last\\\",\\n        \\\"email\\\": \\\"email2@example.com\\\"\\n      },\\n      \\\"campaign\\\": {\\n        \\\"id\\\": 123,\\n        \\\"name\\\": \\\"Sample Campaign\\\",\\n        \\\"description\\\": \\\"This is a sample description.\\\"\\n      },\\n      \\\"commission\\\": {\\n        \\\"id\\\": 12345,\\n        \\\"revenue\\\": 20.00,\\n        \\\"amount\\\": 5.00,\\n        \\\"created_at\\\": \\\"2012-04-10T16:15:19\\\",\\n        \\\"approved_at\\\": \\\"2012-04-10T16:15:19\\\",\\n        \\\"status\\\": 1,\\n        \\\"transaction_id\\\": \\\"abc123\\\"\\n      }\\n    }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","parentDoc":null,"project":"5634abe66d460f0d0061264f","next":{"description":"","pages":[]},"createdAt":"2017-02-06T22:09:54.225Z","excerpt":"This event occurs whenever a new commission is created.","hidden":false,"link_url":"","order":8,"slug":"webhooks-commission-created","sync_unique":"","type":"fn","childrenPages":[]}

Commission Created

This event occurs whenever a new commission is created.

__Event Data Objects:__ [block:parameters] { "data": { "h-0": "Object", "h-1": "Description", "h-2": "Description", "0-0": "contact", "0-1": "The referring contact's data", "0-2": "The referring contact's data", "1-0": "referred_contact", "1-1": "The referred contact's data", "1-2": "The customer contact's data", "2-0": "commission", "2-1": "The commission data", "3-0": "campaign", "3-1": "The campaign's data", "3-2": "The campaign's data", "2-2": "The commission data" }, "cols": 2, "rows": 4 } [/block] __Contact Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "unique identifier of the contact within Ambassador", "1-0": "first_name", "1-1": "string", "1-2": "first name", "2-0": "last_name", "2-1": "string", "2-2": "last name", "3-0": "email", "3-1": "string", "3-2": "email address", "4-0": "internal_id", "4-1": "string", "4-2": "unique identifier of the contact supplied by you" }, "cols": 3, "rows": 5 } [/block] __Campaign Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "campaign's ID", "1-0": "name", "1-1": "string", "1-2": "campaign's name", "2-0": "description", "2-1": "string", "2-2": "campaign's description" }, "cols": 3, "rows": 3 } [/block] __Commission Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "commission's ID", "1-0": "revenue", "1-1": "number", "1-2": "revenue amount of commission (ex. customer bought an item worth 20.00)", "2-0": "amount", "2-1": "number", "2-2": "amount earned by commission\n(ex. contact earns 5.00 commission for referring)", "3-0": "created_at", "3-1": "date", "4-0": "approved_at", "4-1": "date", "5-0": "status", "5-1": "boolean", "5-2": "commission's status\n0 = pending\n1 = approved\n2 = denied", "3-2": "date commission was created", "4-2": "date commission was approved", "6-0": "transaction_id", "6-1": "string", "6-2": "commission's transaction id" }, "cols": 3, "rows": 7 } [/block] [block:textarea] { "text": "Webhook Result Format", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"event_id\": 123,\n \"event_type\": \"commission-created\",\n \"event_data\": {\n \t\"contact\": {\n \"id\": 100,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email@example.com\"\n },\n \"referred_contact\": {\n \"id\": 101,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email2@example.com\"\n },\n \"campaign\": {\n \"id\": 123,\n \"name\": \"Sample Campaign\",\n \"description\": \"This is a sample description.\"\n },\n \"commission\": {\n \"id\": 12345,\n \"revenue\": 20.00,\n \"amount\": 5.00,\n \"created_at\": \"2012-04-10T16:15:19\",\n \"approved_at\": \"2012-04-10T16:15:19\",\n \"status\": 1,\n \"transaction_id\": \"abc123\"\n }\n }\n}", "language": "json", "name": "JSON" } ], "sidebar": true } [/block]
__Event Data Objects:__ [block:parameters] { "data": { "h-0": "Object", "h-1": "Description", "h-2": "Description", "0-0": "contact", "0-1": "The referring contact's data", "0-2": "The referring contact's data", "1-0": "referred_contact", "1-1": "The referred contact's data", "1-2": "The customer contact's data", "2-0": "commission", "2-1": "The commission data", "3-0": "campaign", "3-1": "The campaign's data", "3-2": "The campaign's data", "2-2": "The commission data" }, "cols": 2, "rows": 4 } [/block] __Contact Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "unique identifier of the contact within Ambassador", "1-0": "first_name", "1-1": "string", "1-2": "first name", "2-0": "last_name", "2-1": "string", "2-2": "last name", "3-0": "email", "3-1": "string", "3-2": "email address", "4-0": "internal_id", "4-1": "string", "4-2": "unique identifier of the contact supplied by you" }, "cols": 3, "rows": 5 } [/block] __Campaign Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "campaign's ID", "1-0": "name", "1-1": "string", "1-2": "campaign's name", "2-0": "description", "2-1": "string", "2-2": "campaign's description" }, "cols": 3, "rows": 3 } [/block] __Commission Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "commission's ID", "1-0": "revenue", "1-1": "number", "1-2": "revenue amount of commission (ex. customer bought an item worth 20.00)", "2-0": "amount", "2-1": "number", "2-2": "amount earned by commission\n(ex. contact earns 5.00 commission for referring)", "3-0": "created_at", "3-1": "date", "4-0": "approved_at", "4-1": "date", "5-0": "status", "5-1": "boolean", "5-2": "commission's status\n0 = pending\n1 = approved\n2 = denied", "3-2": "date commission was created", "4-2": "date commission was approved", "6-0": "transaction_id", "6-1": "string", "6-2": "commission's transaction id" }, "cols": 3, "rows": 7 } [/block] [block:textarea] { "text": "Webhook Result Format", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"event_id\": 123,\n \"event_type\": \"commission-created\",\n \"event_data\": {\n \t\"contact\": {\n \"id\": 100,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email@example.com\"\n },\n \"referred_contact\": {\n \"id\": 101,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email2@example.com\"\n },\n \"campaign\": {\n \"id\": 123,\n \"name\": \"Sample Campaign\",\n \"description\": \"This is a sample description.\"\n },\n \"commission\": {\n \"id\": 12345,\n \"revenue\": 20.00,\n \"amount\": 5.00,\n \"created_at\": \"2012-04-10T16:15:19\",\n \"approved_at\": \"2012-04-10T16:15:19\",\n \"status\": 1,\n \"transaction_id\": \"abc123\"\n }\n }\n}", "language": "json", "name": "JSON" } ], "sidebar": true } [/block]
{"_id":"589b8ebb1e7c040f00ae3496","category":"5898ea852f65061b002c8712","excerpt":"This event occurs whenever a new payout is created.","link_external":false,"next":{"pages":[],"description":""},"createdAt":"2017-02-08T21:33:47.063Z","githubsync":"","isReference":true,"project":"5634abe66d460f0d0061264f","title":"Payout Created","type":"fn","body":"__Event Data Objects:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"contact\",\n    \"0-1\": \"The contact's data\",\n    \"0-2\": \"The contact's data\",\n    \"1-0\": \"payout\",\n    \"1-1\": \"The payout data\",\n    \"1-2\": \"The payout data\"\n  },\n  \"cols\": 2,\n  \"rows\": 2\n}\n[/block]\n__Contact Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"integer\",\n    \"0-2\": \"unique identifier of the contact within Ambassador\",\n    \"1-0\": \"first_name\",\n    \"1-1\": \"string\",\n    \"1-2\": \"first name\",\n    \"2-0\": \"last_name\",\n    \"2-1\": \"string\",\n    \"2-2\": \"last name\",\n    \"3-0\": \"email\",\n    \"3-1\": \"string\",\n    \"3-2\": \"email address\",\n    \"4-0\": \"internal_id\",\n    \"4-1\": \"string\",\n    \"4-2\": \"unique identifier of the contact supplied by you\"\n  },\n  \"cols\": 3,\n  \"rows\": 5\n}\n[/block]\n__Payout Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"integer\",\n    \"0-2\": \"id of the payout\",\n    \"1-0\": \"created_at\",\n    \"1-1\": \"date\",\n    \"1-2\": \"date payout was created\",\n    \"2-0\": \"amount\",\n    \"2-1\": \"number\",\n    \"2-2\": \"amount of the payout\",\n    \"3-0\": \"unit\",\n    \"3-1\": \"string\",\n    \"3-2\": \"type of payout (money, points)\",\n    \"4-0\": \"payment_method\",\n    \"4-1\": \"string\",\n    \"4-2\": \"payment method of payout (manual, paypal, dwolla, magento, gift_card, voucher)\",\n    \"5-0\": \"gift_card_sku\",\n    \"5-1\": \"string\",\n    \"5-2\": \"SKU of gift card (if gift card payout)\",\n    \"6-0\": \"voucher_code\",\n    \"6-1\": \"string\",\n    \"6-2\": \"voucher code\",\n    \"7-0\": \"transaction_id\",\n    \"7-1\": \"string\",\n    \"7-2\": \"transaction id of payout (if available)\"\n  },\n  \"cols\": 3,\n  \"rows\": 8\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"Webhook Result Format\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"webhook_version\\\": 0.1,\\n    \\\"created_at\\\": \\\"2012-01-19T18:55:10\\\",\\n    \\\"event_id\\\": 123,\\n    \\\"event_type\\\": \\\"payout-created\\\",\\n    \\\"event_data\\\": {\\n      \\\"payout\\\": {\\n        \\\"id\\\": 123, \\n        \\\"unit\\\": \\\"money\\\", \\n        \\\"amount\\\": 0.01, \\n        \\\"created_at\\\": \\\"2016-11-30T20:22:17.322775\\\", \\n        \\\"voucher_code\\\": null, \\n        \\\"gift_card_sku\\\": null, \\n        \\\"payment_method\\\": \\\"manual\\\", \\n        \\\"transaction_id\\\": null\\n      }, \\n      \\\"contact\\\": {\\n        \\\"id\\\": 12345, \\n        \\\"first_name\\\": \\\"First\\\",\\n        \\\"last_name\\\": \\\"Last\\\", \\n        \\\"email\\\": \\\"test@example.com\\\",\\n        \\\"internal_id\\\": \\\"contact-12345\\\"\\n      }\\n    }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","sync_unique":"","user":"5634abcb8b86331700b48916","__v":0,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"language":"json","code":"{}","name":"","status":400}]},"settings":"","auth":"required","params":[],"url":""},"hidden":false,"link_url":"","order":9,"parentDoc":null,"slug":"webhooks-payout-created","updates":[],"version":"5634abe66d460f0d00612652","childrenPages":[]}

Payout Created

This event occurs whenever a new payout is created.

__Event Data Objects:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "h-2": "Description", "0-0": "contact", "0-1": "The contact's data", "0-2": "The contact's data", "1-0": "payout", "1-1": "The payout data", "1-2": "The payout data" }, "cols": 2, "rows": 2 } [/block] __Contact Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "unique identifier of the contact within Ambassador", "1-0": "first_name", "1-1": "string", "1-2": "first name", "2-0": "last_name", "2-1": "string", "2-2": "last name", "3-0": "email", "3-1": "string", "3-2": "email address", "4-0": "internal_id", "4-1": "string", "4-2": "unique identifier of the contact supplied by you" }, "cols": 3, "rows": 5 } [/block] __Payout Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "id of the payout", "1-0": "created_at", "1-1": "date", "1-2": "date payout was created", "2-0": "amount", "2-1": "number", "2-2": "amount of the payout", "3-0": "unit", "3-1": "string", "3-2": "type of payout (money, points)", "4-0": "payment_method", "4-1": "string", "4-2": "payment method of payout (manual, paypal, dwolla, magento, gift_card, voucher)", "5-0": "gift_card_sku", "5-1": "string", "5-2": "SKU of gift card (if gift card payout)", "6-0": "voucher_code", "6-1": "string", "6-2": "voucher code", "7-0": "transaction_id", "7-1": "string", "7-2": "transaction id of payout (if available)" }, "cols": 3, "rows": 8 } [/block] [block:textarea] { "text": "Webhook Result Format", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"event_id\": 123,\n \"event_type\": \"payout-created\",\n \"event_data\": {\n \"payout\": {\n \"id\": 123, \n \"unit\": \"money\", \n \"amount\": 0.01, \n \"created_at\": \"2016-11-30T20:22:17.322775\", \n \"voucher_code\": null, \n \"gift_card_sku\": null, \n \"payment_method\": \"manual\", \n \"transaction_id\": null\n }, \n \"contact\": {\n \"id\": 12345, \n \"first_name\": \"First\",\n \"last_name\": \"Last\", \n \"email\": \"test@example.com\",\n \"internal_id\": \"contact-12345\"\n }\n }\n}", "language": "json", "name": "JSON" } ], "sidebar": true } [/block]
__Event Data Objects:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "h-2": "Description", "0-0": "contact", "0-1": "The contact's data", "0-2": "The contact's data", "1-0": "payout", "1-1": "The payout data", "1-2": "The payout data" }, "cols": 2, "rows": 2 } [/block] __Contact Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "unique identifier of the contact within Ambassador", "1-0": "first_name", "1-1": "string", "1-2": "first name", "2-0": "last_name", "2-1": "string", "2-2": "last name", "3-0": "email", "3-1": "string", "3-2": "email address", "4-0": "internal_id", "4-1": "string", "4-2": "unique identifier of the contact supplied by you" }, "cols": 3, "rows": 5 } [/block] __Payout Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "id of the payout", "1-0": "created_at", "1-1": "date", "1-2": "date payout was created", "2-0": "amount", "2-1": "number", "2-2": "amount of the payout", "3-0": "unit", "3-1": "string", "3-2": "type of payout (money, points)", "4-0": "payment_method", "4-1": "string", "4-2": "payment method of payout (manual, paypal, dwolla, magento, gift_card, voucher)", "5-0": "gift_card_sku", "5-1": "string", "5-2": "SKU of gift card (if gift card payout)", "6-0": "voucher_code", "6-1": "string", "6-2": "voucher code", "7-0": "transaction_id", "7-1": "string", "7-2": "transaction id of payout (if available)" }, "cols": 3, "rows": 8 } [/block] [block:textarea] { "text": "Webhook Result Format", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"event_id\": 123,\n \"event_type\": \"payout-created\",\n \"event_data\": {\n \"payout\": {\n \"id\": 123, \n \"unit\": \"money\", \n \"amount\": 0.01, \n \"created_at\": \"2016-11-30T20:22:17.322775\", \n \"voucher_code\": null, \n \"gift_card_sku\": null, \n \"payment_method\": \"manual\", \n \"transaction_id\": null\n }, \n \"contact\": {\n \"id\": 12345, \n \"first_name\": \"First\",\n \"last_name\": \"Last\", \n \"email\": \"test@example.com\",\n \"internal_id\": \"contact-12345\"\n }\n }\n}", "language": "json", "name": "JSON" } ], "sidebar": true } [/block]
{"_id":"589b90f6dbb7cd1900267336","excerpt":"This event occurs whenever a commission status is changed e.g. commission is approved or denied","githubsync":"","isReference":true,"title":"Commission Status Updated","order":10,"parentDoc":null,"version":"5634abe66d460f0d00612652","__v":0,"createdAt":"2017-02-08T21:43:18.894Z","hidden":false,"link_external":false,"link_url":"","project":"5634abe66d460f0d0061264f","slug":"webhooks-commission-status-updated","sync_unique":"","api":{"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[]},"body":"__Event Data Objects:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"contact\",\n    \"0-1\": \"The referring contact's data\",\n    \"0-2\": \"The referring contact's data\",\n    \"1-0\": \"referred_contact\",\n    \"1-1\": \"The referred contact's data\",\n    \"1-2\": \"The customer contact's data\",\n    \"2-0\": \"commission\",\n    \"2-1\": \"The commission data\",\n    \"3-0\": \"campaign\",\n    \"3-1\": \"The campaign's data\",\n    \"3-2\": \"The campaign's data\",\n    \"2-2\": \"The commission data\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]\n__Contact / Customer Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"integer\",\n    \"0-2\": \"unique identifier of the contact within Ambassador\",\n    \"1-0\": \"first_name\",\n    \"1-1\": \"string\",\n    \"1-2\": \"first name\",\n    \"2-0\": \"last_name\",\n    \"2-1\": \"string\",\n    \"2-2\": \"last name\",\n    \"3-0\": \"email\",\n    \"3-1\": \"string\",\n    \"3-2\": \"email address\",\n    \"4-0\": \"internal_id\",\n    \"4-1\": \"string\",\n    \"4-2\": \"unique identifier of the contact within your system\"\n  },\n  \"cols\": 3,\n  \"rows\": 5\n}\n[/block]\n__Campaign Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"integer\",\n    \"0-2\": \"campaign's id\",\n    \"1-0\": \"name\",\n    \"1-1\": \"string\",\n    \"1-2\": \"campaign's name\",\n    \"2-0\": \"description\",\n    \"2-1\": \"string\",\n    \"2-2\": \"campaign's description\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\n__Commission Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"integer\",\n    \"0-2\": \"commission's ID\",\n    \"1-0\": \"revenue\",\n    \"1-1\": \"number\",\n    \"1-2\": \"revenue amount of commission (ex. customer bought an item worth 20.00)\",\n    \"2-0\": \"amount\",\n    \"2-1\": \"number\",\n    \"2-2\": \"amount earned by commission\\n(ex. contact earns 5.00 commission for referring)\",\n    \"3-0\": \"created_at\",\n    \"3-1\": \"date\",\n    \"4-0\": \"approved_at\",\n    \"4-1\": \"date\",\n    \"5-0\": \"status\",\n    \"5-1\": \"boolean\",\n    \"5-2\": \"commission's status\",\n    \"3-2\": \"date commission was created\",\n    \"4-2\": \"date commission was approved\"\n  },\n  \"cols\": 3,\n  \"rows\": 6\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"Webhook Result Format\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"webhook_version\\\": 0.1,\\n    \\\"created_at\\\": \\\"2012-01-19T18:55:10\\\",\\n    \\\"event_id\\\": 123,\\n    \\\"event_type\\\": \\\"commission-status-updated\\\",\\n    \\\"event_data\\\": {\\n    \\t\\\"contact\\\": {\\n        \\\"id\\\": 100,\\n        \\\"first_name\\\": \\\"First\\\",\\n        \\\"last_name\\\": \\\"Last\\\",\\n        \\\"email\\\": \\\"email@example.com\\\"\\n      },\\n      \\\"referred_contact\\\": {\\n        \\\"id\\\": 101,\\n        \\\"first_name\\\": \\\"First\\\",\\n        \\\"last_name\\\": \\\"Last\\\",\\n        \\\"email\\\": \\\"email2@example.com\\\"\\n      },\\n      \\\"campaign\\\": {\\n        \\\"id\\\": 123,\\n        \\\"name\\\": \\\"Sample Campaign\\\",\\n        \\\"description\\\": \\\"This is a sample description.\\\"\\n      },\\n      \\\"commission\\\": {\\n        \\\"id\\\": 12345,\\n        \\\"revenue\\\": 20.00,\\n        \\\"amount\\\": 5.00,\\n        \\\"created_at\\\": \\\"2012-04-10T16:15:19\\\",\\n        \\\"approved_at\\\": \\\"2012-04-10T16:15:19\\\",\\n        \\\"status\\\": 1\\n      }\\n    }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","category":"5898ea852f65061b002c8712","next":{"description":"","pages":[]},"type":"fn","updates":[],"user":"5634abcb8b86331700b48916","childrenPages":[]}

Commission Status Updated

This event occurs whenever a commission status is changed e.g. commission is approved or denied

__Event Data Objects:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "h-2": "Description", "0-0": "contact", "0-1": "The referring contact's data", "0-2": "The referring contact's data", "1-0": "referred_contact", "1-1": "The referred contact's data", "1-2": "The customer contact's data", "2-0": "commission", "2-1": "The commission data", "3-0": "campaign", "3-1": "The campaign's data", "3-2": "The campaign's data", "2-2": "The commission data" }, "cols": 2, "rows": 4 } [/block] __Contact / Customer Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "unique identifier of the contact within Ambassador", "1-0": "first_name", "1-1": "string", "1-2": "first name", "2-0": "last_name", "2-1": "string", "2-2": "last name", "3-0": "email", "3-1": "string", "3-2": "email address", "4-0": "internal_id", "4-1": "string", "4-2": "unique identifier of the contact within your system" }, "cols": 3, "rows": 5 } [/block] __Campaign Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "campaign's id", "1-0": "name", "1-1": "string", "1-2": "campaign's name", "2-0": "description", "2-1": "string", "2-2": "campaign's description" }, "cols": 3, "rows": 3 } [/block] __Commission Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "commission's ID", "1-0": "revenue", "1-1": "number", "1-2": "revenue amount of commission (ex. customer bought an item worth 20.00)", "2-0": "amount", "2-1": "number", "2-2": "amount earned by commission\n(ex. contact earns 5.00 commission for referring)", "3-0": "created_at", "3-1": "date", "4-0": "approved_at", "4-1": "date", "5-0": "status", "5-1": "boolean", "5-2": "commission's status", "3-2": "date commission was created", "4-2": "date commission was approved" }, "cols": 3, "rows": 6 } [/block] [block:textarea] { "text": "Webhook Result Format", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"event_id\": 123,\n \"event_type\": \"commission-status-updated\",\n \"event_data\": {\n \t\"contact\": {\n \"id\": 100,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email@example.com\"\n },\n \"referred_contact\": {\n \"id\": 101,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email2@example.com\"\n },\n \"campaign\": {\n \"id\": 123,\n \"name\": \"Sample Campaign\",\n \"description\": \"This is a sample description.\"\n },\n \"commission\": {\n \"id\": 12345,\n \"revenue\": 20.00,\n \"amount\": 5.00,\n \"created_at\": \"2012-04-10T16:15:19\",\n \"approved_at\": \"2012-04-10T16:15:19\",\n \"status\": 1\n }\n }\n}", "language": "json", "name": "JSON" } ], "sidebar": true } [/block]
__Event Data Objects:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "h-2": "Description", "0-0": "contact", "0-1": "The referring contact's data", "0-2": "The referring contact's data", "1-0": "referred_contact", "1-1": "The referred contact's data", "1-2": "The customer contact's data", "2-0": "commission", "2-1": "The commission data", "3-0": "campaign", "3-1": "The campaign's data", "3-2": "The campaign's data", "2-2": "The commission data" }, "cols": 2, "rows": 4 } [/block] __Contact / Customer Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "unique identifier of the contact within Ambassador", "1-0": "first_name", "1-1": "string", "1-2": "first name", "2-0": "last_name", "2-1": "string", "2-2": "last name", "3-0": "email", "3-1": "string", "3-2": "email address", "4-0": "internal_id", "4-1": "string", "4-2": "unique identifier of the contact within your system" }, "cols": 3, "rows": 5 } [/block] __Campaign Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "campaign's id", "1-0": "name", "1-1": "string", "1-2": "campaign's name", "2-0": "description", "2-1": "string", "2-2": "campaign's description" }, "cols": 3, "rows": 3 } [/block] __Commission Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "commission's ID", "1-0": "revenue", "1-1": "number", "1-2": "revenue amount of commission (ex. customer bought an item worth 20.00)", "2-0": "amount", "2-1": "number", "2-2": "amount earned by commission\n(ex. contact earns 5.00 commission for referring)", "3-0": "created_at", "3-1": "date", "4-0": "approved_at", "4-1": "date", "5-0": "status", "5-1": "boolean", "5-2": "commission's status", "3-2": "date commission was created", "4-2": "date commission was approved" }, "cols": 3, "rows": 6 } [/block] [block:textarea] { "text": "Webhook Result Format", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2012-01-19T18:55:10\",\n \"event_id\": 123,\n \"event_type\": \"commission-status-updated\",\n \"event_data\": {\n \t\"contact\": {\n \"id\": 100,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email@example.com\"\n },\n \"referred_contact\": {\n \"id\": 101,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email2@example.com\"\n },\n \"campaign\": {\n \"id\": 123,\n \"name\": \"Sample Campaign\",\n \"description\": \"This is a sample description.\"\n },\n \"commission\": {\n \"id\": 12345,\n \"revenue\": 20.00,\n \"amount\": 5.00,\n \"created_at\": \"2012-04-10T16:15:19\",\n \"approved_at\": \"2012-04-10T16:15:19\",\n \"status\": 1\n }\n }\n}", "language": "json", "name": "JSON" } ], "sidebar": true } [/block]
{"_id":"591f271da4747419000f7f6f","slug":"contact-added-to-campaign","sync_unique":"","isReference":true,"project":"5634abe66d460f0d0061264f","user":"56ddedf5502b132000191327","createdAt":"2017-05-19T17:10:53.116Z","hidden":false,"api":{"auth":"required","params":[],"url":"","settings":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]}},"category":"5898ea852f65061b002c8712","excerpt":"This event occurs whenever a contact gains access to one of your campaigns","link_url":"","next":{"pages":[],"description":""},"order":11,"__v":0,"updates":[],"version":"5634abe66d460f0d00612652","title":"Contact Added to Campaign","type":"fn","link_external":false,"body":"__Event Data Objects:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Description\",\n    \"0-2\": \"The referring contact's data\",\n    \"0-0\": \"contact\",\n    \"0-1\": \"the contact's data\",\n    \"1-0\": \"campaign\",\n    \"1-1\": \"the campaign the contact is gaining access to\",\n    \"1-2\": \"the campaign's data\"\n  },\n  \"cols\": 2,\n  \"rows\": 2\n}\n[/block]\n__Contact Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"integer\",\n    \"0-2\": \"id of the contact\",\n    \"1-0\": \"first_name\",\n    \"1-1\": \"string\",\n    \"1-2\": \"first name of the contact\",\n    \"2-0\": \"last_name\",\n    \"2-1\": \"string\",\n    \"2-2\": \"last name of the contact\",\n    \"3-0\": \"email\",\n    \"3-1\": \"string\",\n    \"3-2\": \"email of the contact\",\n    \"4-0\": \"internal_id\",\n    \"4-1\": \"string\",\n    \"4-2\": \"your customer's id in your system\"\n  },\n  \"cols\": 3,\n  \"rows\": 5\n}\n[/block]\n__Campaign Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"integer\",\n    \"0-2\": \"id of the campaign\",\n    \"1-0\": \"name\",\n    \"1-1\": \"string\",\n    \"1-2\": \"name of the campaign\",\n    \"2-0\": \"description\",\n    \"2-1\": \"string\",\n    \"2-2\": \"name of the campaign\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"Webhook Result Format\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"webhook_version\\\": 0.1,\\n    \\\"created_at\\\": \\\"2017-01-19T10:35:10\\\",\\n    \\\"event_id\\\": 123\\n    \\\"event_type\\\": \\\"contact-added-to-campaign\\\"\\n    \\\"event_data\\\": {\\n        \\\"contact\\\": {\\n            \\\"id\\\": 100,\\n            \\\"first_name\\\": \\\"First\\\",\\n            \\\"last_name\\\": \\\"Last\\\",\\n            \\\"email\\\": \\\"example@email.com\\\",\\n            \\\"internal_id\\\": \\\"your-company-contact-id\\\"\\n        },\\n        \\\"campaign\\\": {\\n            \\\"id\\\": 123,\\n            \\\"name\\\": \\\"Campaign\\\",\\n            \\\"description\\\": \\\"Description\\\"\\n        }\\n    }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","githubsync":"","parentDoc":null,"childrenPages":[]}

Contact Added to Campaign

This event occurs whenever a contact gains access to one of your campaigns

__Event Data Objects:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "h-2": "Description", "0-2": "The referring contact's data", "0-0": "contact", "0-1": "the contact's data", "1-0": "campaign", "1-1": "the campaign the contact is gaining access to", "1-2": "the campaign's data" }, "cols": 2, "rows": 2 } [/block] __Contact Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "id of the contact", "1-0": "first_name", "1-1": "string", "1-2": "first name of the contact", "2-0": "last_name", "2-1": "string", "2-2": "last name of the contact", "3-0": "email", "3-1": "string", "3-2": "email of the contact", "4-0": "internal_id", "4-1": "string", "4-2": "your customer's id in your system" }, "cols": 3, "rows": 5 } [/block] __Campaign Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "id of the campaign", "1-0": "name", "1-1": "string", "1-2": "name of the campaign", "2-0": "description", "2-1": "string", "2-2": "name of the campaign" }, "cols": 3, "rows": 3 } [/block] [block:textarea] { "text": "Webhook Result Format", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2017-01-19T10:35:10\",\n \"event_id\": 123\n \"event_type\": \"contact-added-to-campaign\"\n \"event_data\": {\n \"contact\": {\n \"id\": 100,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"example@email.com\",\n \"internal_id\": \"your-company-contact-id\"\n },\n \"campaign\": {\n \"id\": 123,\n \"name\": \"Campaign\",\n \"description\": \"Description\"\n }\n }\n}", "language": "json", "name": "JSON" } ], "sidebar": true } [/block]
__Event Data Objects:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "h-2": "Description", "0-2": "The referring contact's data", "0-0": "contact", "0-1": "the contact's data", "1-0": "campaign", "1-1": "the campaign the contact is gaining access to", "1-2": "the campaign's data" }, "cols": 2, "rows": 2 } [/block] __Contact Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "id of the contact", "1-0": "first_name", "1-1": "string", "1-2": "first name of the contact", "2-0": "last_name", "2-1": "string", "2-2": "last name of the contact", "3-0": "email", "3-1": "string", "3-2": "email of the contact", "4-0": "internal_id", "4-1": "string", "4-2": "your customer's id in your system" }, "cols": 3, "rows": 5 } [/block] __Campaign Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "id of the campaign", "1-0": "name", "1-1": "string", "1-2": "name of the campaign", "2-0": "description", "2-1": "string", "2-2": "name of the campaign" }, "cols": 3, "rows": 3 } [/block] [block:textarea] { "text": "Webhook Result Format", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2017-01-19T10:35:10\",\n \"event_id\": 123\n \"event_type\": \"contact-added-to-campaign\"\n \"event_data\": {\n \"contact\": {\n \"id\": 100,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"example@email.com\",\n \"internal_id\": \"your-company-contact-id\"\n },\n \"campaign\": {\n \"id\": 123,\n \"name\": \"Campaign\",\n \"description\": \"Description\"\n }\n }\n}", "language": "json", "name": "JSON" } ], "sidebar": true } [/block]
{"_id":"591f418555c52e1900d54907","body":"__Event Data Objects:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Description\",\n    \"0-2\": \"The referring contact's data\",\n    \"0-0\": \"contact\",\n    \"0-1\": \"the referring contact's data\",\n    \"1-0\": \"segment\",\n    \"1-1\": \"the segment the contact is falling into\",\n    \"1-2\": \"the campaign's data\"\n  },\n  \"cols\": 2,\n  \"rows\": 2\n}\n[/block]\n__Contact Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"integer\",\n    \"0-2\": \"id of the contact\",\n    \"1-0\": \"first_name\",\n    \"1-1\": \"string\",\n    \"1-2\": \"first name of the contact\",\n    \"2-0\": \"last_name\",\n    \"2-1\": \"string\",\n    \"2-2\": \"last name of the contact\",\n    \"3-0\": \"email\",\n    \"3-1\": \"string\",\n    \"3-2\": \"email of the contact\",\n    \"4-0\": \"internal_id\",\n    \"4-1\": \"string\",\n    \"4-2\": \"your customer's id in your system\"\n  },\n  \"cols\": 3,\n  \"rows\": 5\n}\n[/block]\n__Segment Fields:__\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"integer\",\n    \"0-2\": \"id of the segment\",\n    \"1-0\": \"name\",\n    \"1-1\": \"string\",\n    \"1-2\": \"name of the segment\",\n    \"3-0\": \"description\",\n    \"3-1\": \"string\",\n    \"3-2\": \"the segment description\",\n    \"2-0\": \"legacy_id\",\n    \"2-1\": \"string\",\n    \"2-2\": \"the legacy id (previously known as the group_id)\"\n  },\n  \"cols\": 3,\n  \"rows\": 4\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"Webhook Result Format\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"webhook_version\\\": 0.1,\\n    \\\"created_at\\\": \\\"2017-01-19T10:35:10\\\",\\n    \\\"event_id\\\": 123,\\n    \\\"event_type\\\": \\\"contact-added-to-segment\\\",\\n    \\\"event_data\\\": {\\n        \\\"contact\\\": {\\n            \\\"id\\\": 100,\\n            \\\"first_name\\\": \\\"First\\\",\\n            \\\"last_name\\\": \\\"Last\\\",\\n            \\\"email\\\": \\\"email@example.com\\\",\\n            \\\"internal_id\\\": \\\"your-company-contact-id\\\"\\n        },\\n        \\\"segment\\\": {\\n            \\\"id\\\": 101,\\n            \\\"name\\\": \\\"Segment\\\",\\n            \\\"legacy_id\\\": \\\"1\\\",\\n            \\\"description\\\": \\\"Description\\\"\\n        }\\n    }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","category":"5898ea852f65061b002c8712","sync_unique":"","hidden":false,"link_external":false,"next":{"pages":[],"description":""},"order":12,"slug":"contact-added-to-segment","updates":[],"__v":0,"createdAt":"2017-05-19T19:03:33.270Z","githubsync":"","project":"5634abe66d460f0d0061264f","version":"5634abe66d460f0d00612652","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"excerpt":"This event occurs whenever a contact is added to one your segments","isReference":true,"link_url":"","title":"Contact Added to Segment","type":"fn","user":"56ddedf5502b132000191327","parentDoc":null,"childrenPages":[]}

Contact Added to Segment

This event occurs whenever a contact is added to one your segments

__Event Data Objects:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "h-2": "Description", "0-2": "The referring contact's data", "0-0": "contact", "0-1": "the referring contact's data", "1-0": "segment", "1-1": "the segment the contact is falling into", "1-2": "the campaign's data" }, "cols": 2, "rows": 2 } [/block] __Contact Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "id of the contact", "1-0": "first_name", "1-1": "string", "1-2": "first name of the contact", "2-0": "last_name", "2-1": "string", "2-2": "last name of the contact", "3-0": "email", "3-1": "string", "3-2": "email of the contact", "4-0": "internal_id", "4-1": "string", "4-2": "your customer's id in your system" }, "cols": 3, "rows": 5 } [/block] __Segment Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "id of the segment", "1-0": "name", "1-1": "string", "1-2": "name of the segment", "3-0": "description", "3-1": "string", "3-2": "the segment description", "2-0": "legacy_id", "2-1": "string", "2-2": "the legacy id (previously known as the group_id)" }, "cols": 3, "rows": 4 } [/block] [block:textarea] { "text": "Webhook Result Format", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2017-01-19T10:35:10\",\n \"event_id\": 123,\n \"event_type\": \"contact-added-to-segment\",\n \"event_data\": {\n \"contact\": {\n \"id\": 100,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email@example.com\",\n \"internal_id\": \"your-company-contact-id\"\n },\n \"segment\": {\n \"id\": 101,\n \"name\": \"Segment\",\n \"legacy_id\": \"1\",\n \"description\": \"Description\"\n }\n }\n}", "language": "json", "name": "JSON" } ], "sidebar": true } [/block]
__Event Data Objects:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "h-2": "Description", "0-2": "The referring contact's data", "0-0": "contact", "0-1": "the referring contact's data", "1-0": "segment", "1-1": "the segment the contact is falling into", "1-2": "the campaign's data" }, "cols": 2, "rows": 2 } [/block] __Contact Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "id of the contact", "1-0": "first_name", "1-1": "string", "1-2": "first name of the contact", "2-0": "last_name", "2-1": "string", "2-2": "last name of the contact", "3-0": "email", "3-1": "string", "3-2": "email of the contact", "4-0": "internal_id", "4-1": "string", "4-2": "your customer's id in your system" }, "cols": 3, "rows": 5 } [/block] __Segment Fields:__ [block:parameters] { "data": { "h-0": "Field", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "id of the segment", "1-0": "name", "1-1": "string", "1-2": "name of the segment", "3-0": "description", "3-1": "string", "3-2": "the segment description", "2-0": "legacy_id", "2-1": "string", "2-2": "the legacy id (previously known as the group_id)" }, "cols": 3, "rows": 4 } [/block] [block:textarea] { "text": "Webhook Result Format", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "{\n \"webhook_version\": 0.1,\n \"created_at\": \"2017-01-19T10:35:10\",\n \"event_id\": 123,\n \"event_type\": \"contact-added-to-segment\",\n \"event_data\": {\n \"contact\": {\n \"id\": 100,\n \"first_name\": \"First\",\n \"last_name\": \"Last\",\n \"email\": \"email@example.com\",\n \"internal_id\": \"your-company-contact-id\"\n },\n \"segment\": {\n \"id\": 101,\n \"name\": \"Segment\",\n \"legacy_id\": \"1\",\n \"description\": \"Description\"\n }\n }\n}", "language": "json", "name": "JSON" } ], "sidebar": true } [/block]
{"_id":"56e1c9472506700e00de6e7f","api":{"settings":"","url":"","auth":"required","params":[],"results":{"codes":[{"code":"{}","name":"","status":200,"language":"json"},{"name":"","status":400,"language":"json","code":"{}"}]}},"__v":4,"createdAt":"2016-03-10T19:21:43.504Z","link_url":"","sync_unique":"","version":"5634abe66d460f0d00612652","updates":[],"githubsync":"","hidden":false,"link_external":false,"order":0,"parentDoc":null,"title":"Cookie Fetching","type":"basic","user":"56ddedf5502b132000191327","body":"### Cookie \"mbsy_short_code\" Fetching Snippet\n\nIf you want to fetch the visitor's referring \"mbsy\" short code from their cookie to send to your back-end, you may include the following JavaScript snippet on your page.\n\nNOTE: You do not need to include this snippet when using the ecommerce, form, image, or javascript integration snippets as we will fetch the visitor's referral cookie automatically.\n\nThe snippet will set the JavaScript variable \"mbsy_short_code\" equal to the referrer's short code (which is also passed to your landing page via the querystring).\n\nIf the visitor was not referred by anyone the variable will be set as an empty string.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script type=\\\"text/javascript\\\" src=\\\"https://mbsy.co/embed/v2/getcookie/[[app:username]]\\\"></script>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]","category":"56e1c8ff92bf640e00b55632","excerpt":"","isReference":false,"project":"5634abe66d460f0d0061264f","slug":"cookie-fetching","childrenPages":[]}

Cookie Fetching


### Cookie "mbsy_short_code" Fetching Snippet If you want to fetch the visitor's referring "mbsy" short code from their cookie to send to your back-end, you may include the following JavaScript snippet on your page. NOTE: You do not need to include this snippet when using the ecommerce, form, image, or javascript integration snippets as we will fetch the visitor's referral cookie automatically. The snippet will set the JavaScript variable "mbsy_short_code" equal to the referrer's short code (which is also passed to your landing page via the querystring). If the visitor was not referred by anyone the variable will be set as an empty string. [block:code] { "codes": [ { "code": "<script type=\"text/javascript\" src=\"https://mbsy.co/embed/v2/getcookie/[[app:username]]\"></script>", "language": "html" } ] } [/block]
### Cookie "mbsy_short_code" Fetching Snippet If you want to fetch the visitor's referring "mbsy" short code from their cookie to send to your back-end, you may include the following JavaScript snippet on your page. NOTE: You do not need to include this snippet when using the ecommerce, form, image, or javascript integration snippets as we will fetch the visitor's referral cookie automatically. The snippet will set the JavaScript variable "mbsy_short_code" equal to the referrer's short code (which is also passed to your landing page via the querystring). If the visitor was not referred by anyone the variable will be set as an empty string. [block:code] { "codes": [ { "code": "<script type=\"text/javascript\" src=\"https://mbsy.co/embed/v2/getcookie/[[app:username]]\"></script>", "language": "html" } ] } [/block]
{"_id":"56e2e31f4cd67e220032d693","githubsync":"","isReference":false,"link_url":"","next":{"description":"","pages":[]},"order":2,"parentDoc":null,"__v":4,"excerpt":"","slug":"form","type":"basic","updates":[],"body":"### Integration: Embeddable Form\nThis form allows people to sign up to become an ambassador and track referral form signups for the provided campaign. Once Ambassador processes the form, we forward the user to a page you designate (such as a thank-you page or a Salesforce Web-to-Lead URL) along with all of the form's POST data.\n\nThe example code is pre-filled with campaign information for you, but you may want to customize the fields and their respective values.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Required Fields:\",\n  \"body\": \"* mbsy_username\\n* mbsy_campaign_uid\\n* email\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"mbsy_username\",\n    \"h-0\": \"Variable\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Options\",\n    \"h-3\": \"Default\",\n    \"0-1\": \"Your company's username\",\n    \"1-0\": \"mbsy_campaign_uid\",\n    \"1-1\": \"Your campaign's ID\",\n    \"2-0\": \"email\",\n    \"2-1\": \"Your customer's email address\",\n    \"3-0\": \"mbsy_short_code\",\n    \"3-1\": \"Referrer's \\\"mbsy\\\" shortcode\",\n    \"4-0\": \"revenue\",\n    \"4-1\": \"Revenue amount of the event\",\n    \"5-0\": \"mbsy_transaction_uid\",\n    \"5-1\": \"Unique transaction ID from the event\",\n    \"6-0\": \"mbsy_uid\",\n    \"6-1\": \"Your customer's internal unique ID\",\n    \"8-0\": \"last_name\",\n    \"8-1\": \"Your customer's last name\",\n    \"12-0\": \"mbsy_custom1\",\n    \"12-1\": \"Custom field - related to ambassador\",\n    \"13-0\": \"mbsy_custom2\",\n    \"13-1\": \"Custom field - related to ambassador\",\n    \"14-0\": \"mbsy_custom3\",\n    \"14-1\": \"Custom field - related to ambassador\",\n    \"15-0\": \"mbsy_email_new_ambassador\",\n    \"15-1\": \"Email login credentials to new ambassadors\",\n    \"15-2\": \"1 - yes\\n0 - no\",\n    \"15-3\": \"1\",\n    \"16-0\": \"mbsy_deactivate_new_ambassador\",\n    \"16-1\": \"New ambassadors created are deactivated\",\n    \"16-2\": \"1 - yes\\n0 - no\",\n    \"16-3\": \"0\",\n    \"17-0\": \"mbsy_auto_create\",\n    \"17-1\": \"If the customer is not an ambassador, create them\",\n    \"17-2\": \"1 - yes\\n0 - no\",\n    \"17-3\": \"1\",\n    \"18-0\": \"mbsy_return_ambassador\",\n    \"18-1\": \"Return new ambassador's memorable share link\",\n    \"18-2\": \"\\\"GET\\\"\\n\\\"POST\\\"\",\n    \"18-3\": \"disabled\",\n    \"19-0\": \"mbsy_add_to_group_id\",\n    \"19-1\": \"Define which group(s) new ambassadors will be created in. Using this parameter will override default group settings. Group IDs should be separated by commas. If mbsy_add_to_group_id=-1, then ambassador will not be added to any group\",\n    \"20-0\": \"mbsy_api_method\",\n    \"7-0\": \"first_name\",\n    \"7-1\": \"Your customer's first name\",\n    \"20-1\": \"API method to call. When \\\"ambassador/get\\\" method is used, following parameters are ignored: mbsy_campaign_uid, revenue, mbsy_transaction_uid\",\n    \"20-2\": \"event/record\\nambassador/get\",\n    \"20-3\": \"event/record\",\n    \"21-0\": \"mbsy_forward_url\",\n    \"21-1\": \"page to forward to\",\n    \"22-0\": \"mbsy_form_method\",\n    \"22-1\": \"method to use when sending data to the forward url\",\n    \"22-2\": \"get\\npost\",\n    \"22-3\": \"post\",\n    \"23-0\": \"mbsy_sandbox\",\n    \"9-0\": \"mbsy_street\",\n    \"10-0\": \"mbsy_state\",\n    \"11-0\": \"mbsy_zip\",\n    \"9-1\": \"Your customer's address\",\n    \"10-1\": \"Your customer's state\",\n    \"11-1\": \"Your customer's zip code\",\n    \"23-2\": \"1 - yes\\n0 - no\",\n    \"23-1\": \"Create customer in sandbox\"\n  },\n  \"cols\": 4,\n  \"rows\": 24\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \" <form action=\\\"https://mbsy.co/embed/v2/form\\\" method=\\\"POST\\\">\\n\\n    <input type=\\\"hidden\\\" name=\\\"mbsy_username\\\" value=\\\"[[app:username]]\\\">\\n    <input type=\\\"hidden\\\" name=\\\"mbsy_campaign_uid\\\" value=\\\"0000\\\">\\n    <input type=\\\"hidden\\\" name=\\\"revenue\\\" value=\\\"0\\\">\\n    <input type=\\\"hidden\\\" name=\\\"mbsy_email_new_ambassador\\\" value=\\\"1\\\">\\n    <input type=\\\"hidden\\\" name=\\\"mbsy_forward_url\\\" value=\\\"http://google.com\\\">\\n    <input type=\\\"hidden\\\" name=\\\"mbsy_api_method\\\" value=\\\"event/record\\\">\\n\\n    <label for=\\\"first_name\\\">First Name</label>\\n    <input  id=\\\"first_name\\\" maxlength=\\\"40\\\" name=\\\"first_name\\\" size=\\\"20\\\" type=\\\"text\\\" />\\n    <br/>\\n    <label for=\\\"last_name\\\">Last Name</label>\\n    <input  id=\\\"last_name\\\" maxlength=\\\"80\\\" name=\\\"last_name\\\" size=\\\"20\\\" type=\\\"text\\\" />\\n    <br/>\\n    <label for=\\\"email\\\">Email</label>\\n    <input  id=\\\"email\\\" maxlength=\\\"80\\\" name=\\\"email\\\" size=\\\"20\\\" type=\\\"text\\\" />\\n    <br/>\\n    <label for=\\\"phone\\\">Phone</label>\\n    <input  id=\\\"phone\\\" maxlength=\\\"40\\\" name=\\\"mbsy_custom1\\\" size=\\\"20\\\" type=\\\"text\\\" />\\n    <br/>\\n    <label for=\\\"company\\\">Company</label>\\n    <input  id=\\\"company\\\" maxlength=\\\"40\\\" name=\\\"mbsy_custom2\\\" size=\\\"20\\\" type=\\\"text\\\" />\\n    <br/>\\n\\n    <input type=\\\"submit\\\" name=\\\"submit\\\">\\n\\n    </form>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]","category":"56e1c8ff92bf640e00b55632","hidden":false,"sync_unique":"","api":{"auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":""},"createdAt":"2016-03-11T15:24:15.795Z","link_external":false,"project":"5634abe66d460f0d0061264f","title":"Form","user":"56ddedf5502b132000191327","version":"5634abe66d460f0d00612652","childrenPages":[]}

Form


### Integration: Embeddable Form This form allows people to sign up to become an ambassador and track referral form signups for the provided campaign. Once Ambassador processes the form, we forward the user to a page you designate (such as a thank-you page or a Salesforce Web-to-Lead URL) along with all of the form's POST data. The example code is pre-filled with campaign information for you, but you may want to customize the fields and their respective values. [block:callout] { "type": "warning", "title": "Required Fields:", "body": "* mbsy_username\n* mbsy_campaign_uid\n* email" } [/block] [block:parameters] { "data": { "0-0": "mbsy_username", "h-0": "Variable", "h-1": "Description", "h-2": "Options", "h-3": "Default", "0-1": "Your company's username", "1-0": "mbsy_campaign_uid", "1-1": "Your campaign's ID", "2-0": "email", "2-1": "Your customer's email address", "3-0": "mbsy_short_code", "3-1": "Referrer's \"mbsy\" shortcode", "4-0": "revenue", "4-1": "Revenue amount of the event", "5-0": "mbsy_transaction_uid", "5-1": "Unique transaction ID from the event", "6-0": "mbsy_uid", "6-1": "Your customer's internal unique ID", "8-0": "last_name", "8-1": "Your customer's last name", "12-0": "mbsy_custom1", "12-1": "Custom field - related to ambassador", "13-0": "mbsy_custom2", "13-1": "Custom field - related to ambassador", "14-0": "mbsy_custom3", "14-1": "Custom field - related to ambassador", "15-0": "mbsy_email_new_ambassador", "15-1": "Email login credentials to new ambassadors", "15-2": "1 - yes\n0 - no", "15-3": "1", "16-0": "mbsy_deactivate_new_ambassador", "16-1": "New ambassadors created are deactivated", "16-2": "1 - yes\n0 - no", "16-3": "0", "17-0": "mbsy_auto_create", "17-1": "If the customer is not an ambassador, create them", "17-2": "1 - yes\n0 - no", "17-3": "1", "18-0": "mbsy_return_ambassador", "18-1": "Return new ambassador's memorable share link", "18-2": "\"GET\"\n\"POST\"", "18-3": "disabled", "19-0": "mbsy_add_to_group_id", "19-1": "Define which group(s) new ambassadors will be created in. Using this parameter will override default group settings. Group IDs should be separated by commas. If mbsy_add_to_group_id=-1, then ambassador will not be added to any group", "20-0": "mbsy_api_method", "7-0": "first_name", "7-1": "Your customer's first name", "20-1": "API method to call. When \"ambassador/get\" method is used, following parameters are ignored: mbsy_campaign_uid, revenue, mbsy_transaction_uid", "20-2": "event/record\nambassador/get", "20-3": "event/record", "21-0": "mbsy_forward_url", "21-1": "page to forward to", "22-0": "mbsy_form_method", "22-1": "method to use when sending data to the forward url", "22-2": "get\npost", "22-3": "post", "23-0": "mbsy_sandbox", "9-0": "mbsy_street", "10-0": "mbsy_state", "11-0": "mbsy_zip", "9-1": "Your customer's address", "10-1": "Your customer's state", "11-1": "Your customer's zip code", "23-2": "1 - yes\n0 - no", "23-1": "Create customer in sandbox" }, "cols": 4, "rows": 24 } [/block] [block:code] { "codes": [ { "code": " <form action=\"https://mbsy.co/embed/v2/form\" method=\"POST\">\n\n <input type=\"hidden\" name=\"mbsy_username\" value=\"[[app:username]]\">\n <input type=\"hidden\" name=\"mbsy_campaign_uid\" value=\"0000\">\n <input type=\"hidden\" name=\"revenue\" value=\"0\">\n <input type=\"hidden\" name=\"mbsy_email_new_ambassador\" value=\"1\">\n <input type=\"hidden\" name=\"mbsy_forward_url\" value=\"http://google.com\">\n <input type=\"hidden\" name=\"mbsy_api_method\" value=\"event/record\">\n\n <label for=\"first_name\">First Name</label>\n <input id=\"first_name\" maxlength=\"40\" name=\"first_name\" size=\"20\" type=\"text\" />\n <br/>\n <label for=\"last_name\">Last Name</label>\n <input id=\"last_name\" maxlength=\"80\" name=\"last_name\" size=\"20\" type=\"text\" />\n <br/>\n <label for=\"email\">Email</label>\n <input id=\"email\" maxlength=\"80\" name=\"email\" size=\"20\" type=\"text\" />\n <br/>\n <label for=\"phone\">Phone</label>\n <input id=\"phone\" maxlength=\"40\" name=\"mbsy_custom1\" size=\"20\" type=\"text\" />\n <br/>\n <label for=\"company\">Company</label>\n <input id=\"company\" maxlength=\"40\" name=\"mbsy_custom2\" size=\"20\" type=\"text\" />\n <br/>\n\n <input type=\"submit\" name=\"submit\">\n\n </form>", "language": "html" } ] } [/block]
### Integration: Embeddable Form This form allows people to sign up to become an ambassador and track referral form signups for the provided campaign. Once Ambassador processes the form, we forward the user to a page you designate (such as a thank-you page or a Salesforce Web-to-Lead URL) along with all of the form's POST data. The example code is pre-filled with campaign information for you, but you may want to customize the fields and their respective values. [block:callout] { "type": "warning", "title": "Required Fields:", "body": "* mbsy_username\n* mbsy_campaign_uid\n* email" } [/block] [block:parameters] { "data": { "0-0": "mbsy_username", "h-0": "Variable", "h-1": "Description", "h-2": "Options", "h-3": "Default", "0-1": "Your company's username", "1-0": "mbsy_campaign_uid", "1-1": "Your campaign's ID", "2-0": "email", "2-1": "Your customer's email address", "3-0": "mbsy_short_code", "3-1": "Referrer's \"mbsy\" shortcode", "4-0": "revenue", "4-1": "Revenue amount of the event", "5-0": "mbsy_transaction_uid", "5-1": "Unique transaction ID from the event", "6-0": "mbsy_uid", "6-1": "Your customer's internal unique ID", "8-0": "last_name", "8-1": "Your customer's last name", "12-0": "mbsy_custom1", "12-1": "Custom field - related to ambassador", "13-0": "mbsy_custom2", "13-1": "Custom field - related to ambassador", "14-0": "mbsy_custom3", "14-1": "Custom field - related to ambassador", "15-0": "mbsy_email_new_ambassador", "15-1": "Email login credentials to new ambassadors", "15-2": "1 - yes\n0 - no", "15-3": "1", "16-0": "mbsy_deactivate_new_ambassador", "16-1": "New ambassadors created are deactivated", "16-2": "1 - yes\n0 - no", "16-3": "0", "17-0": "mbsy_auto_create", "17-1": "If the customer is not an ambassador, create them", "17-2": "1 - yes\n0 - no", "17-3": "1", "18-0": "mbsy_return_ambassador", "18-1": "Return new ambassador's memorable share link", "18-2": "\"GET\"\n\"POST\"", "18-3": "disabled", "19-0": "mbsy_add_to_group_id", "19-1": "Define which group(s) new ambassadors will be created in. Using this parameter will override default group settings. Group IDs should be separated by commas. If mbsy_add_to_group_id=-1, then ambassador will not be added to any group", "20-0": "mbsy_api_method", "7-0": "first_name", "7-1": "Your customer's first name", "20-1": "API method to call. When \"ambassador/get\" method is used, following parameters are ignored: mbsy_campaign_uid, revenue, mbsy_transaction_uid", "20-2": "event/record\nambassador/get", "20-3": "event/record", "21-0": "mbsy_forward_url", "21-1": "page to forward to", "22-0": "mbsy_form_method", "22-1": "method to use when sending data to the forward url", "22-2": "get\npost", "22-3": "post", "23-0": "mbsy_sandbox", "9-0": "mbsy_street", "10-0": "mbsy_state", "11-0": "mbsy_zip", "9-1": "Your customer's address", "10-1": "Your customer's state", "11-1": "Your customer's zip code", "23-2": "1 - yes\n0 - no", "23-1": "Create customer in sandbox" }, "cols": 4, "rows": 24 } [/block] [block:code] { "codes": [ { "code": " <form action=\"https://mbsy.co/embed/v2/form\" method=\"POST\">\n\n <input type=\"hidden\" name=\"mbsy_username\" value=\"[[app:username]]\">\n <input type=\"hidden\" name=\"mbsy_campaign_uid\" value=\"0000\">\n <input type=\"hidden\" name=\"revenue\" value=\"0\">\n <input type=\"hidden\" name=\"mbsy_email_new_ambassador\" value=\"1\">\n <input type=\"hidden\" name=\"mbsy_forward_url\" value=\"http://google.com\">\n <input type=\"hidden\" name=\"mbsy_api_method\" value=\"event/record\">\n\n <label for=\"first_name\">First Name</label>\n <input id=\"first_name\" maxlength=\"40\" name=\"first_name\" size=\"20\" type=\"text\" />\n <br/>\n <label for=\"last_name\">Last Name</label>\n <input id=\"last_name\" maxlength=\"80\" name=\"last_name\" size=\"20\" type=\"text\" />\n <br/>\n <label for=\"email\">Email</label>\n <input id=\"email\" maxlength=\"80\" name=\"email\" size=\"20\" type=\"text\" />\n <br/>\n <label for=\"phone\">Phone</label>\n <input id=\"phone\" maxlength=\"40\" name=\"mbsy_custom1\" size=\"20\" type=\"text\" />\n <br/>\n <label for=\"company\">Company</label>\n <input id=\"company\" maxlength=\"40\" name=\"mbsy_custom2\" size=\"20\" type=\"text\" />\n <br/>\n\n <input type=\"submit\" name=\"submit\">\n\n </form>", "language": "html" } ] } [/block]
{"_id":"56e2e7063987d729008695c6","version":"5634abe66d460f0d00612652","createdAt":"2016-03-11T15:40:54.659Z","excerpt":"","link_url":"","sync_unique":"","title":"Image","__v":2,"project":"5634abe66d460f0d0061264f","slug":"image","user":"56ddedf5502b132000191327","link_external":false,"order":3,"parentDoc":null,"updates":[],"type":"basic","api":{"auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":""},"body":"### Integration: Embeddable Image Snippet\nPaste this image snippet on the \"success\" page of the event you are tracking.\n\nThe example code is pre-filled with campaign information for you, but you will need to alter the \"mbsy_email\" to correlate with your new customer.\n\nMultiple campaign events can be triggered by specifying multiple campaigns separated by commas in the \"mbsy_campaign_uid\" variable. The events will occur in the order provided.\n\nDon't paste more than one image snippet on your page.\n\nSee the table below the code for additional data you can pass us.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Required Fields:\",\n  \"body\": \"*  mbsy_username\\n*  mbsy_campaign_uid\\n* mbsy_email\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Variable\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Options\",\n    \"h-3\": \"Default\",\n    \"1-0\": \"mbsy_campaign_uid\",\n    \"1-1\": \"Your campaign's ID(s)\",\n    \"2-0\": \"mbsy_email\",\n    \"2-1\": \"Your customer's email address\",\n    \"4-0\": \"mbsy_revenue\",\n    \"4-1\": \"Revenue amount of the event\",\n    \"5-0\": \"mbsy_transaction_uid\",\n    \"5-1\": \"Unique transaction ID for the event\",\n    \"6-0\": \"mbsy_uid\",\n    \"6-1\": \"Your customer's internal unique ID\",\n    \"7-0\": \"mbsy_first_name\",\n    \"7-1\": \"Your customer's first name\",\n    \"8-0\": \"mbsy_last_name\",\n    \"8-1\": \"Your customer's last name\",\n    \"9-0\": \"mbsy_email_new_ambassador\",\n    \"9-1\": \"Email login credentials to new ambassadors\",\n    \"9-2\": \"1 - yes\\n0 - no\",\n    \"9-3\": \"1\",\n    \"10-0\": \"mbsy_deactivate_new_ambassador\",\n    \"10-1\": \"New ambassadors created are deactivated\",\n    \"10-2\": \"1 - yes\\n0 - no\",\n    \"10-3\": \"0\",\n    \"11-0\": \"mbsy_auto_create\",\n    \"11-1\": \"If the customer is not an ambassador, create them\",\n    \"13-0\": \"mbsy_event_data1\",\n    \"14-0\": \"mbsy_event_data2\",\n    \"15-0\": \"mbsy_event_data3\",\n    \"13-1\": \"Custom field - related to event/commission\",\n    \"14-1\": \"Custom field - related to event/commission\",\n    \"15-1\": \"Custom field - related to event/commission\",\n    \"16-0\": \"mbsy_is_approved\",\n    \"16-1\": \"Commission status\",\n    \"16-3\": \"campaign setting\",\n    \"16-2\": \"1 - approved\\n0 - pending\",\n    \"0-0\": \"mbsy_username\",\n    \"0-1\": \"Your company's username\",\n    \"3-0\": \"mbsy_short_code\",\n    \"3-1\": \"Referrer's \\\"mbsy\\\" shortcode\",\n    \"11-2\": \"1 - yes\\n0 - no\",\n    \"11-3\": \"0 (1 if you signed up before Nov 5 2013)\",\n    \"12-0\": \"mbsy_add_to_group_id\",\n    \"12-1\": \"Define which group(s) new ambassadors will be created in. Using this parameter will override default group settings. Group IDs should be separated by commas. If mbsy_add_to_group_id=-1, then ambassador will not be added to any group\"\n  },\n  \"cols\": 4,\n  \"rows\": 17\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \" <img src=\\\"https://mbsy.co/embed/v2/img/?mbsy_username=[[app:username]]&mbsy_campaign_uid=000&mbsy_email=example@example.com&mbsy_revenue=0.00\\\" style=\\\"border: none; display: none\\\" alt=\\\"\\\" />\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]","category":"56e1c8ff92bf640e00b55632","githubsync":"","hidden":false,"isReference":false,"childrenPages":[]}

Image


### Integration: Embeddable Image Snippet Paste this image snippet on the "success" page of the event you are tracking. The example code is pre-filled with campaign information for you, but you will need to alter the "mbsy_email" to correlate with your new customer. Multiple campaign events can be triggered by specifying multiple campaigns separated by commas in the "mbsy_campaign_uid" variable. The events will occur in the order provided. Don't paste more than one image snippet on your page. See the table below the code for additional data you can pass us. [block:callout] { "type": "warning", "title": "Required Fields:", "body": "* mbsy_username\n* mbsy_campaign_uid\n* mbsy_email" } [/block] [block:parameters] { "data": { "h-0": "Variable", "h-1": "Description", "h-2": "Options", "h-3": "Default", "1-0": "mbsy_campaign_uid", "1-1": "Your campaign's ID(s)", "2-0": "mbsy_email", "2-1": "Your customer's email address", "4-0": "mbsy_revenue", "4-1": "Revenue amount of the event", "5-0": "mbsy_transaction_uid", "5-1": "Unique transaction ID for the event", "6-0": "mbsy_uid", "6-1": "Your customer's internal unique ID", "7-0": "mbsy_first_name", "7-1": "Your customer's first name", "8-0": "mbsy_last_name", "8-1": "Your customer's last name", "9-0": "mbsy_email_new_ambassador", "9-1": "Email login credentials to new ambassadors", "9-2": "1 - yes\n0 - no", "9-3": "1", "10-0": "mbsy_deactivate_new_ambassador", "10-1": "New ambassadors created are deactivated", "10-2": "1 - yes\n0 - no", "10-3": "0", "11-0": "mbsy_auto_create", "11-1": "If the customer is not an ambassador, create them", "13-0": "mbsy_event_data1", "14-0": "mbsy_event_data2", "15-0": "mbsy_event_data3", "13-1": "Custom field - related to event/commission", "14-1": "Custom field - related to event/commission", "15-1": "Custom field - related to event/commission", "16-0": "mbsy_is_approved", "16-1": "Commission status", "16-3": "campaign setting", "16-2": "1 - approved\n0 - pending", "0-0": "mbsy_username", "0-1": "Your company's username", "3-0": "mbsy_short_code", "3-1": "Referrer's \"mbsy\" shortcode", "11-2": "1 - yes\n0 - no", "11-3": "0 (1 if you signed up before Nov 5 2013)", "12-0": "mbsy_add_to_group_id", "12-1": "Define which group(s) new ambassadors will be created in. Using this parameter will override default group settings. Group IDs should be separated by commas. If mbsy_add_to_group_id=-1, then ambassador will not be added to any group" }, "cols": 4, "rows": 17 } [/block] [block:code] { "codes": [ { "code": " <img src=\"https://mbsy.co/embed/v2/img/?mbsy_username=[[app:username]]&mbsy_campaign_uid=000&mbsy_email=example@example.com&mbsy_revenue=0.00\" style=\"border: none; display: none\" alt=\"\" />", "language": "html" } ] } [/block]
### Integration: Embeddable Image Snippet Paste this image snippet on the "success" page of the event you are tracking. The example code is pre-filled with campaign information for you, but you will need to alter the "mbsy_email" to correlate with your new customer. Multiple campaign events can be triggered by specifying multiple campaigns separated by commas in the "mbsy_campaign_uid" variable. The events will occur in the order provided. Don't paste more than one image snippet on your page. See the table below the code for additional data you can pass us. [block:callout] { "type": "warning", "title": "Required Fields:", "body": "* mbsy_username\n* mbsy_campaign_uid\n* mbsy_email" } [/block] [block:parameters] { "data": { "h-0": "Variable", "h-1": "Description", "h-2": "Options", "h-3": "Default", "1-0": "mbsy_campaign_uid", "1-1": "Your campaign's ID(s)", "2-0": "mbsy_email", "2-1": "Your customer's email address", "4-0": "mbsy_revenue", "4-1": "Revenue amount of the event", "5-0": "mbsy_transaction_uid", "5-1": "Unique transaction ID for the event", "6-0": "mbsy_uid", "6-1": "Your customer's internal unique ID", "7-0": "mbsy_first_name", "7-1": "Your customer's first name", "8-0": "mbsy_last_name", "8-1": "Your customer's last name", "9-0": "mbsy_email_new_ambassador", "9-1": "Email login credentials to new ambassadors", "9-2": "1 - yes\n0 - no", "9-3": "1", "10-0": "mbsy_deactivate_new_ambassador", "10-1": "New ambassadors created are deactivated", "10-2": "1 - yes\n0 - no", "10-3": "0", "11-0": "mbsy_auto_create", "11-1": "If the customer is not an ambassador, create them", "13-0": "mbsy_event_data1", "14-0": "mbsy_event_data2", "15-0": "mbsy_event_data3", "13-1": "Custom field - related to event/commission", "14-1": "Custom field - related to event/commission", "15-1": "Custom field - related to event/commission", "16-0": "mbsy_is_approved", "16-1": "Commission status", "16-3": "campaign setting", "16-2": "1 - approved\n0 - pending", "0-0": "mbsy_username", "0-1": "Your company's username", "3-0": "mbsy_short_code", "3-1": "Referrer's \"mbsy\" shortcode", "11-2": "1 - yes\n0 - no", "11-3": "0 (1 if you signed up before Nov 5 2013)", "12-0": "mbsy_add_to_group_id", "12-1": "Define which group(s) new ambassadors will be created in. Using this parameter will override default group settings. Group IDs should be separated by commas. If mbsy_add_to_group_id=-1, then ambassador will not be added to any group" }, "cols": 4, "rows": 17 } [/block] [block:code] { "codes": [ { "code": " <img src=\"https://mbsy.co/embed/v2/img/?mbsy_username=[[app:username]]&mbsy_campaign_uid=000&mbsy_email=example@example.com&mbsy_revenue=0.00\" style=\"border: none; display: none\" alt=\"\" />", "language": "html" } ] } [/block]
{"_id":"56e2e7efb9c88f2900864a9f","__v":0,"createdAt":"2016-03-11T15:44:47.515Z","link_external":false,"order":5,"project":"5634abe66d460f0d0061264f","type":"basic","version":"5634abe66d460f0d00612652","api":{"results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"language":"json","code":"{}","name":"","status":400}]},"settings":"","auth":"required","params":[],"url":""},"githubsync":"","link_url":"","sync_unique":"","updates":[],"slug":"refer-a-friend-widget","title":"Refer-A-Friend Widget","user":"56ddedf5502b132000191327","body":"### Integration: Refer-A-Friend Widget\nThis embeddable widget allows people to sign up to become an ambassador of your company and share their unique link with their friends via email or social channels.\n\nTo see the refer-a-friend widget in action, click [here](http://www.getambassador.com/refer-a-friend).","category":"56e1c8ff92bf640e00b55632","excerpt":"","hidden":false,"isReference":false,"parentDoc":null,"childrenPages":[]}

Refer-A-Friend Widget


### Integration: Refer-A-Friend Widget This embeddable widget allows people to sign up to become an ambassador of your company and share their unique link with their friends via email or social channels. To see the refer-a-friend widget in action, click [here](http://www.getambassador.com/refer-a-friend).
### Integration: Refer-A-Friend Widget This embeddable widget allows people to sign up to become an ambassador of your company and share their unique link with their friends via email or social channels. To see the refer-a-friend widget in action, click [here](http://www.getambassador.com/refer-a-friend).
{"_id":"56e2e8158ffe6020004c53d4","body":"### Share Tracking Snippet\nIf you want to track shares of short codes from your own system, you may use the following snippet.\n\nNote that it requires the variable \"campaign_link\" to be set to the short url being shared. Use the reference table to determine how to set the variable \"service\".\n\nAlso note that any shares from our system (Ecomm Widget, Refer-a-Friend widget, addThis snippet, and profiles) are automatically tracked by us.\n\nParameters for variable \"service\":\n\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"Twitter\",\n    \"0-1\": \"twitter\",\n    \"1-0\": \"Facebook\",\n    \"1-1\": \"facebook\",\n    \"2-0\": \"Google+\",\n    \"2-1\": \"google_plusone_share\",\n    \"3-0\": \"Linkedin\",\n    \"3-1\": \"linkedin\",\n    \"4-0\": \"Pinterest\",\n    \"4-1\": \"pinterest\",\n    \"5-0\": \"Tumblr\",\n    \"5-1\": \"tumblr\",\n    \"6-0\": \"StumbleUpon\",\n    \"6-1\": \"stumbleupon\",\n    \"7-0\": \"Blogger\",\n    \"7-1\": \"blogger\",\n    \"8-0\": \"Digg\",\n    \"8-1\": \"digg\",\n    \"9-0\": \"Evernote\",\n    \"9-1\": \"evernote\",\n    \"10-0\": \"Friendfeed\",\n    \"10-1\": \"friendfeed\",\n    \"11-0\": \"Myspace\",\n    \"11-1\": \"myspace\",\n    \"12-0\": \"Reddit\",\n    \"12-1\": \"reddit\",\n    \"13-0\": \"Tweetmeme\",\n    \"13-1\": \"tweetmeme\",\n    \"14-0\": \"Email\",\n    \"14-1\": \"email\"\n  },\n  \"cols\": 2,\n  \"rows\": 15\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script type=\\\"text/javascript\\\">\\n        function mbsy_share(service, campaign_link)\\n        {\\n            var xmlhttp;\\n            if(window.XMLHttpRequest)\\n            {\\n                xmlhttp=new XMLHttpRequest();\\n            }else{\\n                xmlhttp=new ActiveXObject(\\\"Microsoft.XMLHTTP\\\");\\n            }\\n            var url_fragments = campaign_link.split(\\\"/\\\");\\n            var short_code = url_fragments[url_fragments.length-1];\\n\\n            xmlhttp.open(\\\"GET\\\",\\\"https://getambassador.com/share_tracker/track_share?short_code=\\\"+short_code+\\\"&social_name=\\\"+service+\\\"\\\",true);\\n            xmlhttp.send();\\n        }\\n    </script>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]","excerpt":"","version":"5634abe66d460f0d00612652","category":"56e1c8ff92bf640e00b55632","hidden":false,"link_external":false,"project":"5634abe66d460f0d0061264f","sync_unique":"","user":"56ddedf5502b132000191327","__v":2,"githubsync":"","isReference":false,"link_url":"","order":6,"slug":"share-tracking","updates":[],"api":{"auth":"required","params":[],"results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"language":"json","code":"{}","name":"","status":400}]},"settings":"","url":""},"createdAt":"2016-03-11T15:45:25.113Z","next":{"description":"","pages":[]},"parentDoc":null,"title":"Share Tracking","type":"basic","childrenPages":[]}

Share Tracking


### Share Tracking Snippet If you want to track shares of short codes from your own system, you may use the following snippet. Note that it requires the variable "campaign_link" to be set to the short url being shared. Use the reference table to determine how to set the variable "service". Also note that any shares from our system (Ecomm Widget, Refer-a-Friend widget, addThis snippet, and profiles) are automatically tracked by us. Parameters for variable "service": [block:parameters] { "data": { "0-0": "Twitter", "0-1": "twitter", "1-0": "Facebook", "1-1": "facebook", "2-0": "Google+", "2-1": "google_plusone_share", "3-0": "Linkedin", "3-1": "linkedin", "4-0": "Pinterest", "4-1": "pinterest", "5-0": "Tumblr", "5-1": "tumblr", "6-0": "StumbleUpon", "6-1": "stumbleupon", "7-0": "Blogger", "7-1": "blogger", "8-0": "Digg", "8-1": "digg", "9-0": "Evernote", "9-1": "evernote", "10-0": "Friendfeed", "10-1": "friendfeed", "11-0": "Myspace", "11-1": "myspace", "12-0": "Reddit", "12-1": "reddit", "13-0": "Tweetmeme", "13-1": "tweetmeme", "14-0": "Email", "14-1": "email" }, "cols": 2, "rows": 15 } [/block] [block:code] { "codes": [ { "code": "<script type=\"text/javascript\">\n function mbsy_share(service, campaign_link)\n {\n var xmlhttp;\n if(window.XMLHttpRequest)\n {\n xmlhttp=new XMLHttpRequest();\n }else{\n xmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\n }\n var url_fragments = campaign_link.split(\"/\");\n var short_code = url_fragments[url_fragments.length-1];\n\n xmlhttp.open(\"GET\",\"https://getambassador.com/share_tracker/track_share?short_code=\"+short_code+\"&social_name=\"+service+\"\",true);\n xmlhttp.send();\n }\n </script>", "language": "html" } ] } [/block]
### Share Tracking Snippet If you want to track shares of short codes from your own system, you may use the following snippet. Note that it requires the variable "campaign_link" to be set to the short url being shared. Use the reference table to determine how to set the variable "service". Also note that any shares from our system (Ecomm Widget, Refer-a-Friend widget, addThis snippet, and profiles) are automatically tracked by us. Parameters for variable "service": [block:parameters] { "data": { "0-0": "Twitter", "0-1": "twitter", "1-0": "Facebook", "1-1": "facebook", "2-0": "Google+", "2-1": "google_plusone_share", "3-0": "Linkedin", "3-1": "linkedin", "4-0": "Pinterest", "4-1": "pinterest", "5-0": "Tumblr", "5-1": "tumblr", "6-0": "StumbleUpon", "6-1": "stumbleupon", "7-0": "Blogger", "7-1": "blogger", "8-0": "Digg", "8-1": "digg", "9-0": "Evernote", "9-1": "evernote", "10-0": "Friendfeed", "10-1": "friendfeed", "11-0": "Myspace", "11-1": "myspace", "12-0": "Reddit", "12-1": "reddit", "13-0": "Tweetmeme", "13-1": "tweetmeme", "14-0": "Email", "14-1": "email" }, "cols": 2, "rows": 15 } [/block] [block:code] { "codes": [ { "code": "<script type=\"text/javascript\">\n function mbsy_share(service, campaign_link)\n {\n var xmlhttp;\n if(window.XMLHttpRequest)\n {\n xmlhttp=new XMLHttpRequest();\n }else{\n xmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\n }\n var url_fragments = campaign_link.split(\"/\");\n var short_code = url_fragments[url_fragments.length-1];\n\n xmlhttp.open(\"GET\",\"https://getambassador.com/share_tracker/track_share?short_code=\"+short_code+\"&social_name=\"+service+\"\",true);\n xmlhttp.send();\n }\n </script>", "language": "html" } ] } [/block]
{"_id":"56e2e8cd3987d729008695cc","slug":"single-sign-on","__v":7,"api":{"auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":""},"body":"### Single Sign-on\nTo enable a user to seamlessly login to both your website and their ambassador portal, please complete the following steps:\n\n1. Ensure you have access to single sign-on with your plan. If you're not sure, please check with your success coach.\n2. Copy the code snippet below and modify for your language/framework of choice to generate your SSO login URL.\n3. Trigger the code on the page that follows a successful authentication (user login) on your website.\n4. Populate the $mbsy_email variable in the snippet. You can use all other parameters listed in the ambassador/get API method.\n5. Ensure you call the company/token API method to get a new token before generating each SSO login URL. The token is short-lived and only good for one use.\n6. Authenticate your user via SSO using one of the following two methods:\n * Display an <img> tag with the src attribute set to your SSO login URL (example below) after your user has logged in to your site. Then redirect your user to https://developers.getambassador.com when they perform some action such as clicking a button to access your referral program.\n`<img src=\"<?php echo $sso_login_url; ?>\" style=\"border: none; visibility: hidden\" alt=\"\" />`\n * Redirect your user to your SSO login URL with the additional parameter \"return_url=https://developers.getambassador.com\". You would typically do this using a link/button your user clicks to access your referral program.\n\nNOTE: To logout a user, do the same and change 'login' to 'logout' in your SSO login URL. Your SSO login URL with its required parameters is https://developers.getambassador.com/sso/login/?token=TOKEN&signature=SIGNATURE&email=EMAIL.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n\\n    $username = '[[app:username]]';\\n    $api_key = '[[app:key]]';\\n    $response_type = 'json';\\n    $mbsy_token = '';\\n    $mbsy_email = ''; // Set this to the value of your user's email\\n    $mbsy_signature = sha1($api_key.$mbsy_email);\\n\\n    // Build and make company/token API call\\n    $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/company/token';\\n    $curl_handle = curl_init();\\n    curl_setopt($curl_handle, CURLOPT_URL, $url);\\n    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\\n    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\\n    curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\\n    curl_setopt($curl_handle, CURLOPT_POST, FALSE);\\n    curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\\n    curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\\n    $response = curl_exec($curl_handle);\\n    curl_close($curl_handle);\\n\\n    // Decode json response to array, you'll need to change this if using XML\\n    $response = json_decode($response, TRUE);\\n\\n    // Grab token from response\\n    $mbsy_token = $response['response']['data']['token'];\\n\\n    // SSO login URL\\n    $sso_login_url = 'https://YOUR_SUBDOMAIN.getambassador.com/sso/login/?token=' . $mbsy_token . '&email=' . urlencode($mbsy_email) . '&signature=' . $mbsy_signature;\\n\\n?>\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]","link_url":"","hidden":false,"type":"basic","version":"5634abe66d460f0d00612652","category":"56e1c8ff92bf640e00b55632","githubsync":"","link_external":false,"project":"5634abe66d460f0d0061264f","user":"56ddedf5502b132000191327","sync_unique":"","title":"Single Sign-on","updates":[],"createdAt":"2016-03-11T15:48:29.982Z","excerpt":"","isReference":false,"order":7,"parentDoc":null,"next":{"description":"","pages":[]},"childrenPages":[]}

Single Sign-on


### Single Sign-on To enable a user to seamlessly login to both your website and their ambassador portal, please complete the following steps: 1. Ensure you have access to single sign-on with your plan. If you're not sure, please check with your success coach. 2. Copy the code snippet below and modify for your language/framework of choice to generate your SSO login URL. 3. Trigger the code on the page that follows a successful authentication (user login) on your website. 4. Populate the $mbsy_email variable in the snippet. You can use all other parameters listed in the ambassador/get API method. 5. Ensure you call the company/token API method to get a new token before generating each SSO login URL. The token is short-lived and only good for one use. 6. Authenticate your user via SSO using one of the following two methods: * Display an <img> tag with the src attribute set to your SSO login URL (example below) after your user has logged in to your site. Then redirect your user to https://developers.getambassador.com when they perform some action such as clicking a button to access your referral program. `<img src="<?php echo $sso_login_url; ?>" style="border: none; visibility: hidden" alt="" />` * Redirect your user to your SSO login URL with the additional parameter "return_url=https://developers.getambassador.com". You would typically do this using a link/button your user clicks to access your referral program. NOTE: To logout a user, do the same and change 'login' to 'logout' in your SSO login URL. Your SSO login URL with its required parameters is https://developers.getambassador.com/sso/login/?token=TOKEN&signature=SIGNATURE&email=EMAIL. [block:code] { "codes": [ { "code": "<?php\n\n $username = '[[app:username]]';\n $api_key = '[[app:key]]';\n $response_type = 'json';\n $mbsy_token = '';\n $mbsy_email = ''; // Set this to the value of your user's email\n $mbsy_signature = sha1($api_key.$mbsy_email);\n\n // Build and make company/token API call\n $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/company/token';\n $curl_handle = curl_init();\n curl_setopt($curl_handle, CURLOPT_URL, $url);\n curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n curl_setopt($curl_handle, CURLOPT_POST, FALSE);\n curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n $response = curl_exec($curl_handle);\n curl_close($curl_handle);\n\n // Decode json response to array, you'll need to change this if using XML\n $response = json_decode($response, TRUE);\n\n // Grab token from response\n $mbsy_token = $response['response']['data']['token'];\n\n // SSO login URL\n $sso_login_url = 'https://YOUR_SUBDOMAIN.getambassador.com/sso/login/?token=' . $mbsy_token . '&email=' . urlencode($mbsy_email) . '&signature=' . $mbsy_signature;\n\n?>", "language": "php" } ] } [/block]
### Single Sign-on To enable a user to seamlessly login to both your website and their ambassador portal, please complete the following steps: 1. Ensure you have access to single sign-on with your plan. If you're not sure, please check with your success coach. 2. Copy the code snippet below and modify for your language/framework of choice to generate your SSO login URL. 3. Trigger the code on the page that follows a successful authentication (user login) on your website. 4. Populate the $mbsy_email variable in the snippet. You can use all other parameters listed in the ambassador/get API method. 5. Ensure you call the company/token API method to get a new token before generating each SSO login URL. The token is short-lived and only good for one use. 6. Authenticate your user via SSO using one of the following two methods: * Display an <img> tag with the src attribute set to your SSO login URL (example below) after your user has logged in to your site. Then redirect your user to https://developers.getambassador.com when they perform some action such as clicking a button to access your referral program. `<img src="<?php echo $sso_login_url; ?>" style="border: none; visibility: hidden" alt="" />` * Redirect your user to your SSO login URL with the additional parameter "return_url=https://developers.getambassador.com". You would typically do this using a link/button your user clicks to access your referral program. NOTE: To logout a user, do the same and change 'login' to 'logout' in your SSO login URL. Your SSO login URL with its required parameters is https://developers.getambassador.com/sso/login/?token=TOKEN&signature=SIGNATURE&email=EMAIL. [block:code] { "codes": [ { "code": "<?php\n\n $username = '[[app:username]]';\n $api_key = '[[app:key]]';\n $response_type = 'json';\n $mbsy_token = '';\n $mbsy_email = ''; // Set this to the value of your user's email\n $mbsy_signature = sha1($api_key.$mbsy_email);\n\n // Build and make company/token API call\n $url = 'https://getambassador.com/api/v2/'.$username.'/'.$api_key.'/'.$response_type.'/company/token';\n $curl_handle = curl_init();\n curl_setopt($curl_handle, CURLOPT_URL, $url);\n curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);\n curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE);\n curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE);\n curl_setopt($curl_handle, CURLOPT_POST, FALSE);\n curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE);\n curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);\n curl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, FALSE);\n $response = curl_exec($curl_handle);\n curl_close($curl_handle);\n\n // Decode json response to array, you'll need to change this if using XML\n $response = json_decode($response, TRUE);\n\n // Grab token from response\n $mbsy_token = $response['response']['data']['token'];\n\n // SSO login URL\n $sso_login_url = 'https://YOUR_SUBDOMAIN.getambassador.com/sso/login/?token=' . $mbsy_token . '&email=' . urlencode($mbsy_email) . '&signature=' . $mbsy_signature;\n\n?>", "language": "php" } ] } [/block]
{"_id":"564659d4c7687d0d00739ec4","link_url":"","title":"Libraries","type":"basic","updates":[],"githubsync":"","body":"To facilitate the creation of custom seamless integrations, we have a collection of open-source libraries to help you utilize the Ambassador API with your programming language of choice.\n\n- [Ruby](https://github.com/GetAmbassador/mbsy)\n- [PHP](https://github.com/GetAmbassador/ambassador)\n- [Node.js](https://github.com/GetAmbassador/mbsy.js)","category":"564658bca74cd10d00a3f042","createdAt":"2015-11-13T21:44:52.396Z","hidden":false,"order":0,"user":"5634abcb8b86331700b48916","__v":12,"link_external":false,"parentDoc":null,"project":"5634abe66d460f0d0061264f","sync_unique":"","version":"5634abe66d460f0d00612652","api":{"settings":"","url":"","auth":"required","params":[],"results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"status":400,"language":"json","code":"{}","name":""}]}},"excerpt":"","isReference":false,"slug":"libraries","childrenPages":[]}

Libraries


To facilitate the creation of custom seamless integrations, we have a collection of open-source libraries to help you utilize the Ambassador API with your programming language of choice. - [Ruby](https://github.com/GetAmbassador/mbsy) - [PHP](https://github.com/GetAmbassador/ambassador) - [Node.js](https://github.com/GetAmbassador/mbsy.js)
To facilitate the creation of custom seamless integrations, we have a collection of open-source libraries to help you utilize the Ambassador API with your programming language of choice. - [Ruby](https://github.com/GetAmbassador/mbsy) - [PHP](https://github.com/GetAmbassador/ambassador) - [Node.js](https://github.com/GetAmbassador/mbsy.js)